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 Cheffe <ni...@freenet.de> on 2007/02/26 18:34:14 UTC

1.4.x ,endorsed ,xerces2.7.2 ,schema validation problem

Hi folks, 
I have this code under 1.4.2_10:
...
SAXBuilder builder = new SAXBuilder("org.apache.xerces.parsers.SAXParser");
builder.setValidation(true);
builder.setFeature("http://apache.org/xml/features/validation/schema",
true);
builder.setProperty("http://apache.org/xml/properties/schema/externalnoNamespaceSchemaLocation",
"file:C://mask.xsd");
...

The validation is doing correct! All fine.

But when i am starting with the endorsed option to override the xerces.jar
and ..impl.jar etc., i get the following Errror:
Error on line 2: cvc-elt.1: Cannot find the declaration of element 'mask'.

It seems the mask.xsd couldnt be found? Or the Classloader() is mixxing up
the different xerces-versions.

Any suggestions?



-- 
View this message in context: http://www.nabble.com/1.4.x-%2Cendorsed-%2Cxerces2.7.2-%2Cschema-validation-problem-tf3294246.html#a9163242
Sent from the Xerces - J - Users mailing list archive at Nabble.com.


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


Re: 1.4.x ,endorsed ,xerces2.7.2 ,schema validation problem

Posted by Jacob Kjome <ho...@visi.com>.
Quoting Cheffe <ni...@freenet.de>:

>
> Sorry, i already have the right url in my prog file:C://mask.xsd, i only
> posted it false.
>

Are you sure?  You just posted it incorrectly again.

> In an other forum i read this might help, but not for me =(
>
>
Thread.getCurrentThread().setContextClassLoader(this.getClass().getClassLoader());
>

Avoid this like the plague unless you know *exactly* what you are doing. 
Messing with the Thread Context Classloader is tricky stuff.

> It must be a prob with the endorsed option cause if i start without the
> option,the prog works all fine.
>

Well, if things don't work with the latest XercesImpl.jar (2.9.0) and
xml-apis.jar (1.3.04) in JAVA_HOME/jre/lib/endorsed, then things probably only
work without those because of some bug in the old code accidentally allowing it
to work.

> No other suggestions?
>

Not other than double and triple checking the syntax of your URL.  You posted it
wrong twice, which makes me think you didn't really get the point of my previous
post.


Jake

>
> Jacob Kjome wrote:
> >
> >
> > Try using a valid URL...
> >
> > file:/C:/mask.xsd
> > OR
> > file:///C:/mask.xsd
> >
> >
> > Jake
> >
> > Quoting Cheffe <ni...@freenet.de>:
> >
> >>
> >> Hi folks,
> >> I have this code under 1.4.2_10:
> >> ...
> >> SAXBuilder builder = new
> >> SAXBuilder("org.apache.xerces.parsers.SAXParser");
> >> builder.setValidation(true);
> >> builder.setFeature("http://apache.org/xml/features/validation/schema",
> >> true);
> >>
> >
>
builder.setProperty("http://apache.org/xml/properties/schema/externalnoNamespaceSchemaLocation",
> >> "file:C://mask.xsd");
> >> ...
> >>
> >> The validation is doing correct! All fine.
> >>
> >> But when i am starting with the endorsed option to override the
> >> xerces.jar
> >> and ..impl.jar etc., i get the following Errror:
> >> Error on line 2: cvc-elt.1: Cannot find the declaration of element
> >> 'mask'.
> >>
> >> It seems the mask.xsd couldnt be found? Or the Classloader() is mixxing
> >> up
> >> the different xerces-versions.
> >>
> >> Any suggestions?
> >>
> >>
> >>
> >> --
> >> View this message in context:
> >>
> >
>
http://www.nabble.com/1.4.x-%2Cendorsed-%2Cxerces2.7.2-%2Cschema-validation-problem-tf3294246.html#a9163242
> >> Sent from the Xerces - J - Users mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> >> For additional commands, e-mail: j-users-help@xerces.apache.org
> >>
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> > For additional commands, e-mail: j-users-help@xerces.apache.org
> >
> >
> >
>
> --
> View this message in context:
>
http://www.nabble.com/1.4.x-%2Cendorsed-%2Cxerces2.7.2-%2Cschema-validation-problem-tf3294246.html#a9167924
> Sent from the Xerces - J - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org
>




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


Re: 1.4.x ,endorsed ,xerces2.7.2 ,schema validation problem

Posted by Cheffe <ni...@freenet.de>.
Sorry, i already have the right url in my prog file:C://mask.xsd, i only
posted it false.

In an other forum i read this might help, but not for me =(

Thread.getCurrentThread().setContextClassLoader(this.getClass().getClassLoader());

It must be a prob with the endorsed option cause if i start without the
option,the prog works all fine.

No other suggestions?


Jacob Kjome wrote:
> 
> 
> Try using a valid URL...
> 
> file:/C:/mask.xsd
> OR
> file:///C:/mask.xsd
> 
> 
> Jake
> 
> Quoting Cheffe <ni...@freenet.de>:
> 
>>
>> Hi folks,
>> I have this code under 1.4.2_10:
>> ...
>> SAXBuilder builder = new
>> SAXBuilder("org.apache.xerces.parsers.SAXParser");
>> builder.setValidation(true);
>> builder.setFeature("http://apache.org/xml/features/validation/schema",
>> true);
>>
> builder.setProperty("http://apache.org/xml/properties/schema/externalnoNamespaceSchemaLocation",
>> "file:C://mask.xsd");
>> ...
>>
>> The validation is doing correct! All fine.
>>
>> But when i am starting with the endorsed option to override the
>> xerces.jar
>> and ..impl.jar etc., i get the following Errror:
>> Error on line 2: cvc-elt.1: Cannot find the declaration of element
>> 'mask'.
>>
>> It seems the mask.xsd couldnt be found? Or the Classloader() is mixxing
>> up
>> the different xerces-versions.
>>
>> Any suggestions?
>>
>>
>>
>> --
>> View this message in context:
>>
> http://www.nabble.com/1.4.x-%2Cendorsed-%2Cxerces2.7.2-%2Cschema-validation-problem-tf3294246.html#a9163242
>> Sent from the Xerces - J - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
>> For additional commands, e-mail: j-users-help@xerces.apache.org
>>
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/1.4.x-%2Cendorsed-%2Cxerces2.7.2-%2Cschema-validation-problem-tf3294246.html#a9167924
Sent from the Xerces - J - Users mailing list archive at Nabble.com.


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


Re: 1.4.x ,endorsed ,xerces2.7.2 ,schema validation problem

Posted by Cheffe <ni...@freenet.de>.
Cheers,
I tried xerces 2.9 and now it works!
Thx

P.S.
I had 
http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation
and 
file:/C:/mask.xsd

already in my code. It got lost while i was formatting here in the posting
box, because of some linebreaks.
What a shame posted it twice false =)

What a luck i use fop and fop likes xerces 2.9.


Michael Glavassevich wrote:
> 
> And try specifying the correct property name. It's 
> "http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation" 
> not 
> "http://apache.org/xml/properties/schema/externalnoNamespaceSchemaLocation
> ". Note the hyphen.
> 
> Also make sure you're using a recent release like 2.9.0. Xerces 2.6.2 
> (which I assume you're using since there never was and likely never will 
> be a 2.7.2) had a bug which would prevent this from working if you reuse 
> the parser.
> 
> Michael Glavassevich
> XML Parser Development
> IBM Toronto Lab
> E-mail: mrglavas@ca.ibm.com
> E-mail: mrglavas@apache.org
> 
> Jacob Kjome <ho...@visi.com> wrote on 02/26/2007 02:33:30 PM:
> 
>> Try using a valid URL...
>> 
>> file:/C:/mask.xsd
>> OR
>> file:///C:/mask.xsd
>> 
>> 
>> Jake
>> 
>> Quoting Cheffe <ni...@freenet.de>:
>> 
>> >
>> > Hi folks,
>> > I have this code under 1.4.2_10:
>> > ...
>> > SAXBuilder builder = new 
> SAXBuilder("org.apache.xerces.parsers.SAXParser");
>> > builder.setValidation(true);
>> > builder.setFeature("http://apache.org/xml/features/validation/schema",
>> > true);
>> >
>> builder.setProperty("http://apache.
>> org/xml/properties/schema/externalnoNamespaceSchemaLocation",
>> > "file:C://mask.xsd");
>> > ...
>> >
>> > The validation is doing correct! All fine.
>> >
>> > But when i am starting with the endorsed option to override the 
> xerces.jar
>> > and ..impl.jar etc., i get the following Errror:
>> > Error on line 2: cvc-elt.1: Cannot find the declaration of element 
> 'mask'.
>> >
>> > It seems the mask.xsd couldnt be found? Or the Classloader() is 
> mixxing up
>> > the different xerces-versions.
>> >
>> > Any suggestions?
>> >
>> >
>> >
>> > --
>> > View this message in context:
>> >
>> http://www.nabble.com/1.4.x-%2Cendorsed-%2Cxerces2.7.2-%2Cschema-
>> validation-problem-tf3294246.html#a9163242
>> > Sent from the Xerces - J - Users mailing list archive at Nabble.com.
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
>> > For additional commands, e-mail: j-users-help@xerces.apache.org
>> >
>> 
>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
>> For additional commands, e-mail: j-users-help@xerces.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/1.4.x-%2Cendorsed-%2Cxerces2.7.2-%2Cschema-validation-problem-tf3294246.html#a9178166
Sent from the Xerces - J - Users mailing list archive at Nabble.com.


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


Re: 1.4.x ,endorsed ,xerces2.7.2 ,schema validation problem

Posted by Michael Glavassevich <mr...@ca.ibm.com>.
And try specifying the correct property name. It's 
"http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation" 
not 
"http://apache.org/xml/properties/schema/externalnoNamespaceSchemaLocation
". Note the hyphen.

Also make sure you're using a recent release like 2.9.0. Xerces 2.6.2 
(which I assume you're using since there never was and likely never will 
be a 2.7.2) had a bug which would prevent this from working if you reuse 
the parser.

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

Jacob Kjome <ho...@visi.com> wrote on 02/26/2007 02:33:30 PM:

> Try using a valid URL...
> 
> file:/C:/mask.xsd
> OR
> file:///C:/mask.xsd
> 
> 
> Jake
> 
> Quoting Cheffe <ni...@freenet.de>:
> 
> >
> > Hi folks,
> > I have this code under 1.4.2_10:
> > ...
> > SAXBuilder builder = new 
SAXBuilder("org.apache.xerces.parsers.SAXParser");
> > builder.setValidation(true);
> > builder.setFeature("http://apache.org/xml/features/validation/schema",
> > true);
> >
> builder.setProperty("http://apache.
> org/xml/properties/schema/externalnoNamespaceSchemaLocation",
> > "file:C://mask.xsd");
> > ...
> >
> > The validation is doing correct! All fine.
> >
> > But when i am starting with the endorsed option to override the 
xerces.jar
> > and ..impl.jar etc., i get the following Errror:
> > Error on line 2: cvc-elt.1: Cannot find the declaration of element 
'mask'.
> >
> > It seems the mask.xsd couldnt be found? Or the Classloader() is 
mixxing up
> > the different xerces-versions.
> >
> > Any suggestions?
> >
> >
> >
> > --
> > View this message in context:
> >
> http://www.nabble.com/1.4.x-%2Cendorsed-%2Cxerces2.7.2-%2Cschema-
> validation-problem-tf3294246.html#a9163242
> > Sent from the Xerces - J - Users mailing list archive at Nabble.com.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> > For additional commands, e-mail: j-users-help@xerces.apache.org
> >
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org

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


Re: 1.4.x ,endorsed ,xerces2.7.2 ,schema validation problem

Posted by Jacob Kjome <ho...@visi.com>.
Try using a valid URL...

file:/C:/mask.xsd
OR
file:///C:/mask.xsd


Jake

Quoting Cheffe <ni...@freenet.de>:

>
> Hi folks,
> I have this code under 1.4.2_10:
> ...
> SAXBuilder builder = new SAXBuilder("org.apache.xerces.parsers.SAXParser");
> builder.setValidation(true);
> builder.setFeature("http://apache.org/xml/features/validation/schema",
> true);
>
builder.setProperty("http://apache.org/xml/properties/schema/externalnoNamespaceSchemaLocation",
> "file:C://mask.xsd");
> ...
>
> The validation is doing correct! All fine.
>
> But when i am starting with the endorsed option to override the xerces.jar
> and ..impl.jar etc., i get the following Errror:
> Error on line 2: cvc-elt.1: Cannot find the declaration of element 'mask'.
>
> It seems the mask.xsd couldnt be found? Or the Classloader() is mixxing up
> the different xerces-versions.
>
> Any suggestions?
>
>
>
> --
> View this message in context:
>
http://www.nabble.com/1.4.x-%2Cendorsed-%2Cxerces2.7.2-%2Cschema-validation-problem-tf3294246.html#a9163242
> Sent from the Xerces - J - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org
>




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