Bin Xu wrote:
> 
> What you said are exactly right. I need to set an error handler for
> xerces-J's API call. After setting it, the program works fine with good xsd
> and produced errors as expected with some bad xsd files with Xerces-J
> version 1.4.2.
> 
> But for JAXP1.1 when I dbf.setValidating(true) to turn validation on, it
> still complains about Elements must be declared even though the same XML/XSD
> files used in the above testcase was used. It seems to me that the
> DocumentBuilder object obtained from JAXP1.1 failed to recognize the schema
> file, but it works fine with XML file with dtd as schema. It has the same
> behavior in both Xerces 1.3.1 and 1.4.2.

So it sounds like you are using Xschema and not DTD.  I don't think I've
tested that case so there may very well be a bug.  Also, are you
specifying the XSD in the input doc or via an attribute, that might make
some difference.

Also, it was recently brought to my attention that the code in the
javax.xml.parsers package in xerces.jar is outdated.  The latest code is
in the xml-commons repository under java/external.  At one time there
were discussions on [EMAIL PROTECTED] about xml-commons, but they
seem to have died down.  Ideally, the JAXP 1.1 API code which includes
javax.xml.parsers should come from xml-commons and the versions in
xerces.jar should be removed.

I believe you should be able to use the xml-commons version now by
checking it out of CVS and building using ANT.  The output will be an
xml-apis.jar file that can be placed in you classpath before
xerces.jar.  Assuming xerces.jar has the right META-INF resource file,
this will cause xerces to be the parser that gets used as the platform
default parser.  I haven't actually tried this, but please let us know
if it works for you.

-Edwin

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to