Min Lee wrote:
>
> Hi all,
>
> I'm having a strange problem with Xerces (1.3.1) and JAXP. It seems that if
> I use the DOMParser.parse(String) to parse (with validation enabled)
> data/personal-schema.xml, I have no problem. However, if I parse the same
> file using DocumentBuilder API, it seems the parser cannot find the
> personal.xsd and complains that the elements are not declared. I've seen
> similar behaviour for SAXParser.
>
> A snippet of my test program:
> ...
> DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
> dbf.setValidating(true);
> DocumentBuilder db = dbf.newDocumentBuilder();
> Document doc = db.parse(args[0]);
> ...
>
> and the error, from the default error handler is:
>
> Error: URI=file:///E:/personal-schema.xml Line=3: Element type "personnel"
> must be declared.
>
> I've seen this happen 1.4.1 release as well. Any ideas? Thanks in advance
> for your help,
Someone else reported a problem like this recently. I believe the
problem is that the javax.xml.parsers code in xerces.jar is really old
an out of date. The newest code is in the xml-commons repository under
java/external/. You can check it out of CVS and place the resulting
xml-apis.jar file before xerces.jar in your classpath and it should
work. If you haven't already done so I'll try to check on it later
today and get back with you.
-Edwin
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]