Converting Axis2 AXIOM objects to and from DOM objects
One of the biggest annoyances I've found when starting to use Apache Axis2 for web services is the new XML object model called AXIOM.
The annoyance comes from the fact that the W3C Document Object Model (or "DOM") is so commonly used that converting between DOM and AXIOM happens often enough to be annoying. Adding to the frustration was the fact that I couldn't find any way to convert between the two without writing the conversion code myself.
As it happens, theres a utility class provided that can do these conversions for me. This class is
org.apache.axis2.util.XMLUtils, and it provides methods for the following common operations:
- Converting to and from W3C DOM objects.
- Creating an AXIOM tree from an InputStream or Reader.
- Get namespace prefixes and QName objects from DOM nodes.
- Base64 encode a byte array.
Hopefully this post will get picked up by Google and save other developers the frustration that converting between DOM and AXIOM caused me.
blog comments powered by Disqus