geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Keith Visco <kvi...@intalio.com>
Subject Re: XML POJO Update (XMLBeans)
Date Mon, 13 Oct 2003 17:40:17 GMT
Hi Arnaud,

That's the not the same bug. The "bug" you are talking about was
introduced in 0.9.5.2, after we switched the Unmarshaller over to use a
SAX XMLReader by default instead of a SAX Parser by default. The bug
they are seeing I believe was fixed back in 0.9.5.1. The two issues are
related, but are different.

The bug they see is that Castor SOM (Schema Object Model) didn't have
automatic support for the XML namespace. The user would have to specify
this namespace to get around the problem. So I added this support in
0.9.5.1. Part of that upgrade was to throw an exception if the user
tried to declare the XML namespace, which according to the XML namespace
spec shouldn't be declared. All of which, worked fine for everyone,
until I switched to use the XMLReader. After upgrading, people started
complaining that Castor was throwing an exception about "xml" is a
reserved prefix and should not be declared. It worked fine under older
versions of Xerces but not under the newer ones. This is because newer
versions of Xerces call the startPrefixMapping("xml",
"http://www.w3.org/XML/1998/namespace") method when they encounter the
namespace prefix on any element (such as xml:lang) (probably for
convenience to the user, but it's still shouldn't happen in my opinion).
The work-around for 0.9.5.2 was to simply enable namespace processing in
the XMLReader. If namespace processing is enabled, Xerces doesn't call
the startPrefixMapping method with the "xml" namespace.  The CVS version
does contain a patch that checks explicitely for the "xml" namespace in
the startPrefixMapping method and simply ignores it, instead of throwing
an exception.

Anyway, since they are using 0.9.5 they are seeing a real Castor bug,
that was fixed a while back.

Just wanted to clear that up...didn't want the Xerces folks getting
blamed for that particular issue.

--Keith

Arnaud Blandin wrote:
> 
> Hi everyone,
> 
> The behavior you are experiencing appeared when we introduced native
> SAX2 support in support. We believed it is a Xerces bug but we checked
> in a workaround in the latest version of Castor (CVS). You can download
> a nightly build that should include that patch.
> Usually the download information of Castor is available at:
> http://www.castor.org/download.html
> I see you guys are using Maven, I think (I am not 100% sure) that Maven
> has an option to check-out the latest release of a jar if you give it a
> URL.
> 
> Concerning the discussion for a Schema Validator; I usually use Castor
> :) (we implement schema validation in an incremental way; meaning that
> we implemented the core of the validation specified in XML Schema spec
> and people give us feedback on what is missing so that we can complete
> our implementation) else I found that XSV
> (www.ltg.ed.ac.uk/~ht/xsv-status.html) written in Python and XML Schema
> Quality Checker from IBM.
> 
> Let me know what we can do for you,
> 
> Arnaud
> 
> > -----Original Message-----
> > From: Jacek Laskowski [mailto:jacek.laskowski@hp.com]
> > Sent: Monday, October 13, 2003 1:16 PM
> > To: geronimo-dev@incubator.apache.org
> > Subject: Re: XML POJO Update (XMLBeans)
> >
> >
> > Keith Visco wrote:
> >
> > >
> > > Aaron Mulder wrote:
> > >
> > >>On Sun, 12 Oct 2003, Jacek Laskowski wrote:
> > >>
> > >>>Once Castor's team joined the mailing list and are ready
> > to work out
> > >>>any issues we've seen so far, who is in charge of deciding whether
> > >>>Castor is the tool of our choice and we cease
> > *immediatelly* writing
> > >>>POJOs and handling mapping between XMLs and them by hand? I (and
> > >>>Aaron seemed
> > >>>also) don't like writing them by hand, so let's hand it
> > over to a tool
> > >>>which is able to deal with it. If the only problem with
> > Castor is the
> > >>>above point, I don't see why Castor wouldn't be used.
> > >>
> > >>        I can certainly drive this decision.
> > >>
> > >>        On this note, does anyone know of an authoritative yet free
> > >>way to validate a schema?  I'm trying to revise our
> > Geronimo schemas
> > >>to get out of the J2EE namespace.  I'm at a point where
> > Sun's "multi
> > >>schema validator" think my working Geronimo schema is valid but
> > >>XMLBeans thinks its not.  I have no idea "who's right".
> > >>
> > >>        As far as Castor goes, every time I try to run Castor on
> > >>J2EE/Geronimo schemas, I get:
> > >>
> > >>namespace 'http://www.w3.org/XML/1998/namespace' not declared in
> > >>schema at
> > >>org.exolab.castor.xml.schema.reader.Sax2ComponentReader.star
> > tElement(S
> > >>ax2ComponentReader.java:256)
> > >>
> > >>        This doesn't seem to be a fatal error, but no code is
> > >>generated either.  Aargh!  :)
> > >
> > >
> > > Hi Aaron,
> > >
> > > Which version of Castor are you using? It doesn't sound
> > like you are
> > > using 0.9.5.2.
> >
> > I don't know about Aaron's build environment, but
> > http://www.ibiblio.org/maven/castor/jars/ has only castor-0.9.5.jar
> >      which seems to not be the one we ought to use, doesn't it?
> >
> > So, the problem boils down to the question how to upload the latest
> > release of Castor?
> >
> > >
> > > Also, feel free to send me one of the schema you are having
> > problems
> > > with and I will take a look at it.
> >
> > The very similar issue you're able to take a look at once is
> > to download
> > Geronimo sources from CVS and while in modules/core run maven
> > build. You
> >    should see something as follows:
> >
> >      [mkdir] Created dir:
> > /disk/home/jacekl/cvs/geronimo/modules/core/target/castor/gen
> >      [echo] Generating sources for
> > /disk/home/jacekl/cvs/geronimo/modules/core/src/schema/geronim
> > o-ejb-jar.xsd
> >      [java] -- Suppressing non fatal warnings.
> >      [java] namespace 'http://www.w3.org/XML/1998/namespace' not
> > declared in schema
> >      [java]      at
> > org.exolab.castor.xml.schema.reader.Sax2ComponentReader.startE
> > lement(Sax2ComponentReader.java:256)
> >      [java]      at
> > org.apache.xerces.parsers.AbstractSAXParser.startElement(Unkno
> > wn Source)
> >      [java]      at
> > org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyEleme
> > nt(Unknown
> > Source)
> >      [java]      at
> > org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStar
> > tElement(Unknown
> > Source)
> >      [java]      at
> > org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$Fragment
> > ContentDispatcher.dispatch(Unknown
> > Source)
> >      [java]      at
> > org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocu
> > ment(Unknown
> > Source)
> >      [java]      at
> > org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
> >      [java]      at
> > org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
> >      [java]      at org.apache.xerces.parsers.XMLParser.parse(Unknown
> > Source)
> >      [java]      at
> > org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
> >      [java]      at
> > org.exolab.castor.xml.schema.reader.IncludeUnmarshaller.<init>
> > (IncludeUnmarshaller.java:126)
> >      [java]      at
> > org.exolab.castor.xml.schema.reader.SchemaUnmarshaller.startEl
> > ement(SchemaUnmarshaller.java:418)
> >      [java]      at
> > org.exolab.castor.xml.schema.reader.Sax2ComponentReader.startE
> > lement(Sax2ComponentReader.java:253)
> >      [java]      at
> > org.apache.xerces.parsers.AbstractSAXParser.startElement(Unkno
> > wn Source)
> >      [java]      at
> > org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyEleme
> > nt(Unknown
> > Source)
> >      [java]      at
> > org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStar
> > tElement(Unknown
> > Source)
> >      [java]      at
> > org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$Fragment
> > ContentDispatcher.dispatch(Unknown
> > Source)
> >      [java]      at
> > org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocu
> > ment(Unknown
> > Source)
> >      [java]      at
> > org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
> >      [java]      at
> > org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
> >      [java]      at org.apache.xerces.parsers.XMLParser.parse(Unknown
> > Source)
> >      [java]      at
> > org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
> >      [java]      at
> > org.exolab.castor.builder.SourceGenerator.generateSource(Sourc
> > eGenerator.java:518)
> >      [java]      at
> > org.exolab.castor.builder.SourceGenerator.generateSource(Sourc
> > eGenerator.java:571)
> >      [java]      at
> > org.exolab.castor.builder.SourceGenerator.main(SourceGenerator
> > .java:1126)
> >      [touch] Creating
> > /disk/home/jacekl/cvs/geronimo/modules/core/target/castor/gero
> > nimo-ejb-jar.xsd.tstamp
> >      [echo] Compiling to
> > /disk/home/jacekl/cvs/geronimo/modules/core/target/classes
> >      [javac] Compiling 359 source files to
> > /disk/home/jacekl/cvs/geronimo/modules/core/target/classes
> > Note: Some input files use or override a deprecated API.
> > Note: Recompile with -deprecation for details.
> >
> > I'd bet Aaron sees a very similar message if not alike.
> >
> > >
> > > --Keith
> >
> > Jacek
> >

Mime
View raw message