<<binding.xjb>> <<fpml-asset-4-2.xsd>>
<<fpml-cashflow-matching-4-2.xsd>> <<fpml-cd-4-2.xsd>>
<<fpml-doc-4-2.xsd>> <<fpml-enum-4-2.xsd>> <<fpml-eqd-4-2.xsd>>
<<fpml-eq-shared-4-2.xsd>> <<fpml-fx-4-2.xsd>> <<fpml-ird-4-2.xsd>>
<<fpml-main-4-2.xsd>> <<fpml-mktenv-4-2.xsd>> <<fpml-msg-4-2.xsd>>
<<fpml-posttrade-4-2.xsd>> <<fpml-pretrade-4-2.xsd>>
<<fpml-reporting-4-2.xsd>> <<fpml-return-swaps-4-2.xsd>>
<<fpml-riskdef-4-2.xsd>> <<fpml-shared-4-2.xsd>>
<<fpml-shared-4-2.xsx>> <<fpml-tradeexec-4-2.xsd>>
<<fpml-valuation-4-2.xsd>> <<fpml-valuation-base-4-2.xsd>>
<<ml-cd-1-0.xsd>> <<ml-doc-1-0.xsd>> <<ml-main-1-0.xsd>>
<<ml-msg-1-0.xsd>> <<ml-pb-1-0.xsd>> <<ml-shared-1-0.xsd>>
<<xmldsig-core-schema.xsd>> <<cds-basket.xml>>
I'm having some problems using JAXB 1.0. This is my first attempt to
use it, and I may be doing something VERY wrong.
This is a complete scenario, so if I can simplify it, please let me
know.
Lets start with my code:
JAXBContext
jContext=JAXBContext.newInstance("ml:fpml:org.w3._2000._09.xmldsig_");
Unmarshaller unmarshaller = jContext.createUnmarshaller() ;
unmarshaller.setValidating(false);
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(new FileInputStream( xmls[i]));
System.out.println(unmarshaller.unmarshal(doc));
My unmarshalling has a problem. I get the following expection:
DefaultValidationEventHandler: [ERROR]: Unexpected element
{
http://www.fpml.org/2005/FpML-4-2}:header
Location:
javax.xml.bind.UnmarshalException: Unexpected element
{
http://www.fpml.org/2005/FpML-4-2}:header
at
fpml.impl.runtime.SAXUnmarshallerHandlerImpl.handleEvent(SAXUnmarshaller
HandlerImpl.java:551)
at
fpml.impl.runtime.AbstractUnmarshallingEventHandlerImpl.reportError(Abst
ractUnmarshallingEventHandlerImpl.java:148)
at
fpml.impl.runtime.AbstractUnmarshallingEventHandlerImpl.reportError(Abst
ractUnmarshallingEventHandlerImpl.java:145)
at
fpml.impl.runtime.AbstractUnmarshallingEventHandlerImpl.unexpectedEnterE
lement(AbstractUnmarshallingEventHandlerImpl.java:156)
at
fpml.impl.runtime.AbstractUnmarshallingEventHandlerImpl.enterElement(Abs
tractUnmarshallingEventHandlerImpl.java:69)
at
fpml.impl.FpMLElementImpl$Unmarshaller.enterElement(FpMLElementImpl.java
:163)
at
fpml.impl.runtime.AbstractUnmarshallingEventHandlerImpl.revertToParentFr
omEnterElement(AbstractUnmarshallingEventHandlerImpl.java:338)
at
fpml.impl.DocumentImpl$Unmarshaller.enterElement(DocumentImpl.java:133)
at
fpml.impl.FpMLElementImpl$Unmarshaller.enterElement(FpMLElementImpl.java
:158)
at
fpml.impl.runtime.SAXUnmarshallerHandlerImpl.startElement(SAXUnmarshalle
rHandlerImpl.java:134)
at
com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:177)
at
com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:210)
at
com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:183)
at
com.sun.xml.bind.unmarshaller.DOMScanner.parse(DOMScanner.java:72)
at
fpml.impl.runtime.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:169)
at MarchalExample.main(MarchalExample.java:54)
I have a TON of xsd that are all linked together via ml-main-1-0.xsd. I
have attached all the xsds to this email.
When generating the classes, I did:
java -Xmx800m -jar %JAXB_HOME%\lib\jaxb-xjc.jar ml-main-1-0.xsd
-extension -d jschema -b binding.xjb
Here in the content of my binding.xjb
<jxb:bindings version="1.0"
xmlns:jxb="
http://java.sun.com/xml/ns/jaxb"
xmlns:xs="
http://www.w3.org/2001/XMLSchema">
<jxb:bindings schemaLocation="fpml-main-4-2.xsd" node="/xs:schema">
<jxb:schemaBindings>
<jxb:package name="fpml"/>
<jxb:nameXmlTransform>
<jxb:elementName suffix="Element"/>
</jxb:nameXmlTransform>
</jxb:schemaBindings>
</jxb:bindings>
<jxb:bindings schemaLocation="ml-main-1-0.xsd" node="/xs:schema">
<jxb:schemaBindings>
<jxb:package name="ml"/>
<jxb:nameXmlTransform>
<jxb:elementName suffix="Element"/>
</jxb:nameXmlTransform>
</jxb:schemaBindings>
</jxb:bindings>
</jxb:bindings>
I have also attached the xml file I'm trying to unmarchal.
ANY HELP WOULD be appreciated.
Thanks in advance,
Ritesh Patel
--------------------------------------------------------
If you are not an intended recipient of this e-mail, please notify the sender, delete it and do not read, act upon, print, disclose, copy, retain or redistribute it. Click here for important additional terms relating to this e-mail.
http://www.ml.com/email_terms/
--------------------------------------------------------