Usually you wouldn’t mix versions. Build environments like Maven should handle this for you – although even maven can get things wrong. Yesterday I was playing with Apache TomEE looking at migrating some webapp’s away from Apache Tomcat 7. The impetus for this was to get Rest services working and one of the TomEE profiles […]Read more "The problem of mixing library versions"
I had this problem of debugging some xml but when reading the output of some log4j it was almost impossible to read so I needed some way of prettifying the xml quickly. For this example I have the following xml: So how do we pretify this in emacs? Well the first thing to do is […]Read more "Formatting xml in emacs"
NioSax (pronounced ‘Neo-Sax’) provides a Java NIO friendly XML push parser similar in operation to SAX. Unlike SAX, with NioSax it is possible for the xml source to contain partial content (i.e. only part of the XML stream has been received over the network). When this occurs, instead of failing with an error, NioSax simply stops. As soon as your application receives more data you simply call the same instance of the parser again and it will resume parsing where it left off.Read more "NioSax – Sax style xml parser for Java NIO"
While JAXB is a good method of mapping XML into Java objects, if your schema’s are large or complex, generating the required Object graph prior to marshaling into XML can be both tedious and error prone due to the large amount of ‘boiler plate’ code of creating an object, calling accessor methods to set the […]Read more "Implementing Builders with JAXB generated objects"
Back in late 2008, one of the original design goals for the rewrite of my retepXMPP project was to use JAXB for handling the marshalling of XMPP Stanzas into POJO’s. The main ideas behind this was to standardise against the XMPP schemas available online and to make the addition of further protocols easier – mainly […]Read more "Using JAXB to marshall XMPP"
When generating Java sources from an XML Schema with JAXB, the type of field used to represent an attribute is determined by it’s type in the schema. For example, a snippet from jabber-client.xsd: By default, JAXB would create the object (Message in this case) with two String properties. To change this to another object (say […]Read more "Binding custom objects to attributes in JAXB"
With JAXB it does a pretty good job in mapping between XML and Java Objects. In normal use this is fine but what happens when you need to use a custom data type for an attribute? Well JAXB supports this in binding so this article will describe this. The originating issue that’s caused this article […]Read more "Implementing custom types within JAXB"