users@jaxb.java.net

RE: Re: Problems with JAXB 1.0 -- Please help

From: Kirill Grouchnikov <kirillcool_at_yahoo.com>
Date: Thu, 14 Sep 2006 11:13:06 -0700 (PDT)

I wouldn't count on XMLSpy for any kind of XML validation.
Try XML Exchanger (they have Lite version for free and full
version for 30 day evaluation). You can also use schema
validation from JDK 5.0 (SchemaFactory, Schema, Validator).

Kirill

--- "Patel, Ritesh (GMI - Debt Markets Technology)"
<Ritesh_Patel2_at_ml.com> wrote:

> Kohsuke,
> Firstly thanks for your response. Can you please provide
> details on
> "Issue tracker"?
>
> I have checked the xml documents and confirmed they are
> valid. I have
> checked with:
> 1. An XML IDE (XML Spy in particular)
> 2. Xerces sax.Counter (with the flags -n -np -v -s -f
> -dv -m -t).
>
> Thanks,
>
>
> Ritesh Patel
>
> -----Original Message-----
> From: Kohsuke Kawaguchi
> [mailto:Kohsuke.Kawaguchi_at_Sun.COM]
> Sent: Wednesday, September 13, 2006 6:58 PM
> To: users_at_jaxb.dev.java.net
> Subject: Re: Problems with JAXB 1.0 -- Please help
>
>
>
> I appreciate you giving us all the details to reproduce
> the problem, I
> think for this kind of things would be better posted as a
> zip file to
> the issue tracker, where large files are not a problem.
>
> As for your particular problem, I first suggest you to
> validate your
> input document with the schema, just to make sure that it
> is indeed
> valid. After all, that's what the RI is complaining ---
> it sees a header
>
> element where it's not expecting it.
>
> So check with other tools to see if the document is
> really valid.
>
>
> Patel, Ritesh (GMI - Debt Markets Technology) wrote:
> > 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/
> >
> --------------------------------------------------------
> >
> >
> >
> >
>
------------------------------------------------------------------------
> >
> >
>
---------------------------------------------------------------------
>
=== message truncated ===


__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com