Tip: Removing namespaces from XML elements using XMLBeans

I’m a big fan of Apache XMLBeansΒ as it makes parsing, analysing and creating XML documents valid to XML Schemas incredibly easy. A really nice feature of XMLBeans is auto-typing. You can ask it to parse an arbitrary XML document and it will detect if the structure of the XML validates against a XML Schema that has been made known to it. If it does, then an appropriate subclass of the XMLBeans base class (XmlObject, similar in concept to java.lang.Object) is returned by the parser. The subclass allows you to traverse the document as if it is simply a collection of Java beans. Nice!
Continue reading