You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by SHAY <sh...@rafael.co.il> on 2003/06/14 02:21:56 UTC

FW: Problem with validating against xml schema

Hello again,
In my code I'm following exactly the lines of code presented in the sample
code for JAXP.
My code includes:
1. Instance of DocumentBuilderFactory
2. setNamespaceAware = true
3. setValidating = true
I put the
factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage
", "http://www.w3.org/2001/XMLSchema"); in a try block which throws the
IllegalArgumentException during execution.
It seems like the parser which is bundled with J2SE 1.4 (Crimson) does not
support JAXP 1.2
I get the same Exception with xerces 2 (I replaced the JAXP implementation
by putting xerces2.jar at the top of the Classpath).
Do xerces 2 and crimson support JAXP 1.2 ?
Am I missing something here ?


-----Original Message-----
From: K. Venugopal [mailto:k.venugopal@sun.com]
Sent: Thursday, June 12, 2003 8:09 AM
To: xerces-j-user@xml.apache.org
Subject: Re: Problem with xml schema


Hi SHAY ,

Also set the below mentioned properties.

        dbf.setNamespaceAware(true);
        dbf.setAttribute(
        "http://java.sun.com/xml/jaxp/properties/schemaLanguage",
        "http://www.w3.org/2001/XMLSchema");


Regards
venu



Tim Cronin wrote:

see http://xml.apache.org/xerces2-j/faq-dom.html#faq-4

for better information...
it's xalan but it also relates to xerces as well
see http://xml.apache.org/xalan-j/faq.html#faq-N100CB


 -----Original Message-----
From: 	SHAY [mailto:shayb@rafael.co.il]
Sent:	Wednesday, June 11, 2003 4:27 PM
To:	xerces-j-user@xml.apache.org
Subject:	Problem with xml schema

Hello,

I’m encountering a problem in parsing an XML document using the J2SE 1.4
DocumentBuilderFactory (Which should support JAXP 1.2).
Background:
I have created a well-formed XML document that is validated successfully
against a W3C Schema (Located on the same machine). Successful validation
is performed by the XML processor of Internet Explorer. So far so good…
But, when I try to parse the document using the factory of J2SE 1.4 (JAXP
1.2 compatible), the ErrorHandler reports that each element (Starting from
the root) is not declared. For some reason the parser cannot relate the
schema to the instance document.
The instance document is o.k. for sure, so how can I resolve this problem?

Thanks
Shay.


 << File: ATT07751.txt >>


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org






Re: FW: Problem with validating against xml schema

Posted by Jacob Kjome <ho...@visi.com>.
You can't just override the JAXP libraries that come with the JDK by 
putting your own JAXP library in the classpath.  The JDK will ignore it and 
load its own endorsed version.  In order to override that, you'd need to 
add your JAXP library as an endorsed library by putting it in 
JAVA_HOME/jre/lib/endorsed.  Also, when you say you put Xerces at the top 
of the classpath, did you mean xml-apis.jar?  That is the one you need to 
make endorsed.  Just add xercesImpl.jar anywhere in your classpath and you 
will be fine.  Also, I haven't used Xerces to validate a Schema, but if you 
are using JAXP to do it, you will need to provide JAXP with information on 
what implementation your are using to do the validation.  Not sure what the 
system property is, but I imagine you have to set one in order for Xerces 
to be used instead of Crimson.

Jake

At 02:21 AM 6/14/2003 +0200, you wrote:
>Hello again,
>In my code I'm following exactly the lines of code presented in the sample 
>code for JAXP.
>My code includes:
>1. Instance of DocumentBuilderFactory
>2. setNamespaceAware = true
>3. setValidating = true
>I put the 
>factory.setAttribute("<http://java.sun.com/xml/jaxp/properties/schemaLanguage>http://java.sun.com/xml/jaxp/properties/schemaLanguage", 
>"http://www.w3.org/2001/XMLSchema"); in a try block which throws the 
>IllegalArgumentException during execution.
>It seems like the parser which is bundled with J2SE 1.4 (Crimson) does not 
>support JAXP 1.2
>I get the same Exception with xerces 2 (I replaced the JAXP implementation 
>by putting xerces2.jar at the top of the Classpath).
>Do xerces 2 and crimson support JAXP 1.2 ?
>Am I missing something here ?
>
>
>-----Original Message-----
>From: K. Venugopal [mailto:k.venugopal@sun.com]
>Sent: Thursday, June 12, 2003 8:09 AM
>To: xerces-j-user@xml.apache.org
>Subject: Re: Problem with xml schema
>
>Hi SHAY ,
>
>Also set the below mentioned properties.
>
>         dbf.setNamespaceAware(true);
>         dbf.setAttribute(
>         "http://java.sun.com/xml/jaxp/properties/schemaLanguage",
>         "http://www.w3.org/2001/XMLSchema");
>
>
>Regards
>venu
>
>
>
>Tim Cronin wrote:
>>
>>see 
>><http://xml.apache.org/xerces2-j/faq-dom.html#faq-4>http://xml.apache.org/xerces2-j/faq-dom.html#faq-4
>>
>>for better information...
>>it's xalan but it also relates to xerces as well
>>see 
>><http://xml.apache.org/xalan-j/faq.html#faq-N100CB>http://xml.apache.org/xalan-j/faq.html#faq-N100CB
>>
>>
>>>
>>>  -----Original Message-----
>>>From:   SHAY [<ma...@rafael.co.il>mailto:shayb@rafael.co.il]
>>>Sent:   Wednesday, June 11, 2003 4:27 PM
>>>To:     <ma...@xml.apache.org>xerces-j-user@xml.apache.org
>>>Subject:        Problem with xml schema
>>>
>>>Hello,
>>>
>>>I’m encountering a problem in parsing an XML document using the J2SE 1.4
>>>DocumentBuilderFactory (Which should support JAXP 1.2).
>>>Background:
>>>I have created a well-formed XML document that is validated successfully
>>>against a W3C Schema (Located on the same machine). Successful validation
>>>is performed by the XML processor of Internet Explorer. So far so good…
>>>But, when I try to parse the document using the factory of J2SE 1.4 (JAXP
>>>1.2 compatible), the ErrorHandler reports that each element (Starting from
>>>the root) is not declared. For some reason the parser cannot relate the
>>>schema to the instance document.
>>>The instance document is o.k. for sure, so how can I resolve this problem?
>>>
>>>Thanks
>>>Shay.
>>>
>>>
>>>  << File: ATT07751.txt >>
>>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: 
>><ma...@xml.apache.org>xerces-j-user-unsubscribe@xml.apache.org
>>For additional commands, e-mail: 
>><ma...@xml.apache.org>xerces-j-user-help@xml.apache.org
>>
>>
>>