Home » Tag Archives: XML

Tag Archives: XML

JAXB Is Doing It Wrong; Try Xembly

java-logo

JAXB is a 10-year-old Java technology that allows us to convert a Java object into an XML document (marshalling) and back (unmarshalling). This technology is based on setters and getters and, in my opinion, violates key principles of object-oriented programming by turning objects into passive data structures. I would recommend you use Xembly instead for marshalling Java objects into XML ...

Read More »

Validating XML Against XSD(s) in Java

java-logo

There are numerous tools available for validating an XML document against an XSD. These include operating system scripts and tools such as xmllint, XML editors and IDEs, and even online validators. I have found it useful to have my own easy-to-use XML validation tool because of limitations or issues of the previously mentioned approaches. Java makes it easy to write ...

Read More »

XML Manipulation With XML Copy Editor

software-development-2-logo

The XML document format, created in 1996, is still widely used to facilitate communication between disparate systems (though for certain implementations is somewhat being replaced by JSON). As a Java developer, I generally interface with data in an XML document via a DOM parser, but there are occasions where being able to manipulate an XML document directly is advantageous or ...

Read More »

right-pad values with XSLT

software-development-2-logo

In this post an XSLT function that can be used to right-pad the value of an element with a chosen character to a certain length. No rocket science but this might become handy again so by putting it down here I don’t have to reinvent it later. The function itself looks like:               <xsl:stylesheet ...

Read More »

Converting XML to CSV using XSLT 1.0

software-development-2-logo

This post shows you how to convert a simple XML file to CSV using XSLT. Consider the following sample XML:                 <library> <book> <author>Dan Simmons</author> <title>Hyperion</title> <publishDate>1989</publishDate> </book> <book> <author>Douglas Adams</author> <title>The Hitchhiker's Guide to the Galaxy</title> <publishDate>1979</publishDate> </book> </library> This is the desired CSV output: author,title,publishDate Dan Simmons,Hyperion,1989 Douglas Adams,The Hitchhiker's Guide ...

Read More »

Converting JSON to XML to Java Objects using XStream

json-logo

XStream library can be an effective tool for converting JSON to Java to XML translations to and fro. Lets explore each one of them one by one, and see which driver is used. Handling JSONs To convert JSON to Java objects all you have to do is initialize XStream object with an appropriate driver and you are ready to serialise ...

Read More »

XML to Avro Conversion

java-interview-questions-answers

We all know what XML is right?  Just in case not, no problem here is what it is all about.                   <root> <node>5</node> </root> Now, what the computer really needs is the number five and some context around it. In XML you (human and computer) can see how it represents context to ...

Read More »

Announcing EAXY: Making XML easier in Java

java-logo

XML libraries in Java is a minefield. The amount of code required to manipulate and read XML is staggering, the risk of getting class path problems with different libraries is substantial and the handling of namespaces opens for a lot of confusion and errors. The worst thing is that the situation doesn’t seem to improve. A colleague made me aware ...

Read More »
Do you want to know how to develop your skillset and become a ...

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!
Get ready to Rock!
To download the books, please verify your email address by following the instructions found on the email we just sent you.

THANK YOU!

Close