You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by bob bob <ml...@yahoo.com> on 2007/08/13 22:13:25 UTC
How to parse xmlbean when XML is wrapped with bogus element
I have an xsd defined and an xml bean generated from that xsd. I get an xml document I would like to load into my xml bean but it has this <DOCUMENT> element around the xml I want. When I remove this element it works. How do I do this programatically through XMLBeans?
XML:
<?xml version="1.0" encoding="UTF-8"?>
<DOCUMENT TYPE="RPWIP" VERSION="11.2">
<WIPKEYS>
.......
</WIPKEYS>
</DOCUMENT>
Java Code:
XmlOptions validateOptions = new XmlOptions();
HashMap ns = new HashMap();
ns.put("", "http://skywire.com/ccm/global"); // I have to do all this for some reason even though the xml follows the format of the xsd
validateOptions.setLoadSubstituteNamespaces(ns);
WIPKEYSDocument keys = WIPKEYSDocument.Factory.parse(new File("documentstream.txt"), validateOptions); // THIS FAILS because of the <DOCUMENT> Element
Help!
Mike
____________________________________________________________________________________
Looking for a deal? Find great prices on flights and hotels with Yahoo! FareChase.
http://farechase.yahoo.com/