Parsing XML with Java

Here are some notes on parsing XML file with java to extract information Simple Example Assume we have an XML file and we want to extract specific attributes. A sample file could be: With XMLStreamReder Here is the code to quickly scan the XML file and get the values for Read more…

Java XML processing with dom4j

XML DOM Parsing XPath Navigation Use XPath expression to navigate the document tree. Processing a single node To process multiple results, we need to use a List Document Creation You can create a docuemnt from scratch by using the DocumentHelper#createDocuemnt(). Adding nodes and attributes is easy and intuitive. Writing document to Read more…

Java XSL Transform

This is a snippet of code to show how to perform an XSL transformation with Java Below you can see how to XSL Transform using File, StreamSource and StreamResult. And there it is an example of XSL Transform using StringReader and StringWriter. Source code is available on my Git repository: Read more…