MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / fromXml

Method fromXml

CodenameOne/src/com/codename1/mapping/Mappers.java:173–184  ·  view source on GitHub ↗
(String xml, Class<T> type)

Source from the content-addressed store, hash-verified

171 /// Inverse of `#toXml`. Parses the XML text and hands the resulting
172 /// Element to the registered mapper.
173 public static <T> T fromXml(String xml, Class<T> type) {
174 if (xml == null) {
175 return null;
176 }
177 Mapper<T> m = get(type);
178 if (m == null) {
179 throw missing(type);
180 }
181 XMLParser p = new XMLParser();
182 Element root = p.parse(new StringReader(xml));
183 return m.readXml(root);
184 }
185
186 /// Parses XML read from a `Reader` without fully buffering it first.
187 public static <T> T fromXml(Reader xml, Class<T> type) {

Callers 3

invoke30Method · 0.45
invokeStatic0Method · 0.45

Calls 4

getMethod · 0.95
missingMethod · 0.95
parseMethod · 0.95
readXmlMethod · 0.65

Tested by 1