Created
December 7, 2017 00:52
-
-
Save DinoChiesa/04a168afe30600c0b6ea7ad41ba7b310 to your computer and use it in GitHub Desktop.
Deserialize XML (Java fragment)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String canonicalPath = "/users/foo/bar/something.xml"; | |
String xml = new String(Files.readAllBytes(Paths.get(canonicalPath)), StandardCharsets.UTF_8); | |
XMLStreamReader sr = XMLInputFactory.newFactory().createXMLStreamReader(new FileInputStream(cpath)); | |
XmlMapper mapper = new XmlMapper(); | |
Map m = (Map) mapper.readValue(sr, Object.class); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment