[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xerces-j-user
Subject:    Re: Validation using default namespace
From:       John_Greenhow () agd ! nsw ! gov ! au
Date:       2005-01-17 22:22:45
Message-ID: OFD6DD6AF3.2A5F114F-ONCA256F8C.007AAA7A-CA256F8C.007AEED3 () agd ! nsw ! gov ! au
[Download RAW message or body]

--=_alternative 007AEECACA256F8C_=
Content-Type: text/plain; charset="US-ASCII"

Bob, thanks very much for your insights.  It wasn't just my examples that 
were mixed up, but my schemas!   My apologies for spamming the list 
needlessly.

Thanks again, Bob and Michael.


Regards,
John 



Bob Foster <bob@objfac.com> wrote on 18/01/2005 12:19:03 AM:

>  > The schema location worked when I set it as the value of the property
>  > 
> 
"http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation", 

> 
> 
> If it worked, then the schema must have been originally defined with no 
> targetNamespace attribute, so you must have changed the schema. Then you 

> say if you were setting the property in the instance document, you would 

> give a different URI for the location. I'm confused. Maybe you have your 

> examples mixed up.
> 
> First off, did you try to specify the schema location in the document? 
> We know unequivocally that the URI in the document must be relative to 
> the document, per your last example. Does that work? Trying that will at 

> least produce an error message that differentiates between not being 
> able to find the schema and not finding the element decl in the schema.
> 
> Bob Foster
> 
> John_Greenhow@agd.nsw.gov.au wrote:
> > 
> > Hi,
> > 
> > Michael, thankyou very much for your help.  I was indeed missing the 
> > namespace part of the property.  This has fixed one error, but the 
> > second remains:
> > 
> > Illegal XML: cvc-elt.1: Cannot find the declaration of element 'Root'.
> > 
> > 
> > Again, it seems to me that either the schema can't be found or the 
Root 
> > element can't be matched against the one defined in the schema.
> > My schema is now:
> > 
> > <xs:schema  xmlns:xs="http://www.w3.org/2001/XMLSchema" 
> >                         version="0.9" 
> >                         targetNamespace="http://www.mynamespace.com"
> >                         xmlns="http://www.mynamespace.com"
> >                         elementFormDefault="qualified">
> > 
> >   <xs:element name="Root">
> >     <xs:complexType>
> >         blah...
> > 
> > 
> > My instance document begins:
> > 
> > <Root xmlns="http://www.mynamespace.com">
> >         <blah>
> > 
> > 
> > And my code reads:
> >             DocumentBuilderFactory factory = 
> > DocumentBuilderFactory.newInstance(); 
> >             *if*(schemaLocation != *null*) {
> >                 factory.setNamespaceAware(*true*);
> >                 factory.setValidating(*true*);
> > 
> > 
factory.setAttribute("http://apache.org/xml/features/validation/schema", 
> > Boolean.TRUE);
> > 
> > factory.setAttribute("http://apache.
> org/xml/properties/dom/document-class-name", 
> > "org.apache.xerces.dom.PSVIDocumentImpl");
> > 
> >  factory.setAttribute("http://apache.
> org/xml/properties/schema/external-schemaLocation", 
> > schemaLocation);
> >             }
> > 
> > Where schemaLocation is "http://www.mynamespace.com 
> > conf/BDM-FDDNUServletRequest.xsd"
> > 
> > The schema location worked when I set it as the value of the property 
> > 
"http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation
> ", 
> > so presumably the parser's still finding the schema.
> > 
> > If I was specifiying a schema within an instance document I'd use 
> > something like this:
> > 
> > <Root  xmlns="http://www.mynamespace.com"
> >         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >         xsi:schemaLocation="http://www.mynamespace.com 
FormsSchema.xsd">
> > 
> > Does setting the "external-schemaLocation" property on Xerces avoid 
the 
> > need for me to have to set the second of these three properties?
> > 
> > What final connecting element am I still missing?
> > 
> > 
> > Thanks again for your time,
> > 
> > John
> > 
> > 
> > 
> > 
> > 
> > Michael Glavassevich <mrglavas@ca.ibm.com> wrote on 14/01/2005 
09:45:07 AM:
> > 
> >  > Hello John,
> >  >
> >  > The value of the external-schemaLocation property is a list of 
pairs of
> >  > URIs (just like the xsi:schemaLocation attribute [1]), where the 
> > first of
> >  > each pair is a target namespace and the second of each pair is a 
schema
> >  > location hint. Did you specify the target namespace before the 
location
> >  > "conf/BDM-FDDNUServletRequest.xsd"? If not, that probably explains 
> > why you
> >  > get the error.
> >  >
> >  > Thanks.
> >  >
> >  > [1] http://www.w3.org/TR/2004/REC-xmlschema-1-20041028/#schema-loc
> >  >
> >  > John_Greenhow@agd.nsw.gov.au wrote on 01/12/2005 01:15:59 AM:
> >  >
> >  > >
> >  > > Hi,
> >  > >
> >  > > Apologies if this is an FAQ, I've read a thread in the archive 
that
> >  > > seems to match my problem but I can't get the fix to work.  The
> >  > > thread was entitled "Validation fails with targetNamespace ==
> >  > > default" and lives at:  http://mail-archives.apache.
> >  > > org/eyebrowse/ReadMsg?listId=85&msgNo=2861
> >  > >
> >  > > I'm attempting to add a namespace to a schema and instance 
documents
> >  > > that I'm validating on a servlet.
> >  > >
> >  > > I have something like the following as my schema:
> >  > >
> >  > > <xs:schema  xmlns:xs="http://www.w3.org/2001/XMLSchema"
> >  > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-Instance"
> >  > >                         version="0.9"
> >  > > targetNamespace="http://www.mynamespace.com/"
> >  > >                         xmlns="http://www.mynamespace.com/"
> >  > >                         elementFormDefault="qualified">
> >  > >
> >  > >   <xs:element name="Root">
> >  > >     <xs:complexType>
> >  > >           <xs:choice>
> >  > >                 blah blah blah..
> >  > >
> >  > >
> >  > >
> >  > > I have an instance document like this:
> >  > >
> >  > > <Root xmlns="http://www.mynamespace.com/"><blah blah blah..
> >  > >
> >  > >
> >  > > And I'm attempting to set up validation using the following code
> >  > > (and Xerces 2.6.0) :
> >  > >
> >  > >             DocumentBuilderFactory factory = 
DocumentBuilderFactory.
> >  > > newInstance();
> >  > >             if(schemaLocation != null) {
> >  > >                 factory.setNamespaceAware(true);
> >  > >                 factory.setValidating(true);
> >  > >                 factory.setAttribute("http://apache.
> >  > > org/xml/features/validation/schema", Boolean.TRUE);
> >  > >                 factory.setAttribute("http://apache.
> >  > > org/xml/properties/dom/document-class-name", 
"org.apache.xerces.dom.
> >  > > PSVIDocumentImpl");
> >  > >                 factory.setAttribute("http://apache.
> >  > > org/xml/properties/schema/external-schemaLocation", 
schemaLocation);
> >  > >             }
> >  > >
> >  > >
> >  > > I think I've done everything in the checklist mentioned in the
> >  > > archived thread:
> >  > >
> >  > > a) Defined targetNamespace and elementFormDefault on my schema.
> >  > > b) Use namespace defaulting for unprefixed elements in my 
instance
> >  > document.
> >  > > c) Tell the parser the location of the schema (say, "conf/BDM-
> >  > > FDDNUServletRequest.xsd" ).
> >  > >
> >  > >
> >  > > However, validation is failing with the following error:
> >  > >
> >  > > Failed validation with the following errors:
> >  > > Illegal XML: http://www.w3.org/TR/xml-schema-1#SchemaLocation?
> >  > > 
/usr/local/jakarta-tomcat-5.0.18/webapps/BDM-OsirisServer/conf/BDM-
> >  > > FDDNUServerRequest.xsd
> >  > > Illegal XML: cvc-elt.1: Cannot find the declaration of element 
'Root'.
> >  > >
> >  > >
> >  > > Does this mean that it either can't find the schema because the
> >  > > namespace it's using is
> >  > "http://www.w3.org/TR/xml-schema-1#SchemaLocation
> >  > > " instead of the default one mentioned in the instance document?
> >  > >
> >  > > Or does it mean that it's found the schema and I've missed 
something
> >  > > in my instance document?
> >  > >
> >  > > Any hints, pointers or tips as how to get this to validate would 
be
> >  > > gratefully appreciated.
> >  > >
> >  > > Thanks for your time,
> >  > >
> >  > > John Greenhow
> >  > >
> >  >
> >  > Michael Glavassevich
> >  > XML Parser Development
> >  > IBM Toronto Lab
> >  > E-mail: mrglavas@ca.ibm.com
> >  > E-mail: mrglavas@apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org
> 

This message is intended for the addressee named and may contain privileged
or confidential information.  If you are not the intended recipient you must
not use, disclose, copy or distribute this communication.  If you have
received this message in error please delete the email and notify the sender.

Web Site

http://www.lawlink.nsw.gov.au

--=_alternative 007AEECACA256F8C_=
Content-Type: text/html; charset="US-ASCII"


<br><font size=2 face="sans-serif">Bob, thanks very much for your insights.
&nbsp;It wasn't just my examples that were mixed up, but my schemas! &nbsp;
My apologies for spamming the list needlessly.</font>
<br>
<br><font size=2 face="sans-serif">Thanks again, Bob and Michael.</font>
<br>
<br>
<br><font size=2 face="sans-serif">Regards,</font>
<br><font size=2 face="sans-serif">John </font>
<br>
<br>
<br>
<br><font size=2><tt>Bob Foster &lt;bob@objfac.com&gt; wrote on 18/01/2005
12:19:03 AM:<br>
<br>
&gt; &nbsp;&gt; The schema location worked when I set it as the value of
the property<br>
&gt; &nbsp;&gt; <br>
&gt; &quot;http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation&quot;,
<br>
&gt; <br>
&gt; <br>
&gt; If it worked, then the schema must have been originally defined with
no <br>
&gt; targetNamespace attribute, so you must have changed the schema. Then
you <br>
&gt; say if you were setting the property in the instance document, you
would <br>
&gt; give a different URI for the location. I'm confused. Maybe you have
your <br>
&gt; examples mixed up.<br>
&gt; <br>
&gt; First off, did you try to specify the schema location in the document?
<br>
&gt; We know unequivocally that the URI in the document must be relative
to <br>
&gt; the document, per your last example. Does that work? Trying that will
at <br>
&gt; least produce an error message that differentiates between not being
<br>
&gt; able to find the schema and not finding the element decl in the schema.<br>
&gt; <br>
&gt; Bob Foster<br>
&gt; <br>
&gt; John_Greenhow@agd.nsw.gov.au wrote:<br>
&gt; &gt; <br>
&gt; &gt; Hi,<br>
&gt; &gt; <br>
&gt; &gt; Michael, thankyou very much for your help. &nbsp;I was indeed
missing the <br>
&gt; &gt; namespace part of the property. &nbsp;This has fixed one error,
but the <br>
&gt; &gt; second remains:<br>
&gt; &gt; <br>
&gt; &gt; Illegal XML: cvc-elt.1: Cannot find the declaration of element
'Root'.<br>
&gt; &gt; <br>
&gt; &gt; <br>
&gt; &gt; Again, it seems to me that either the schema can't be found or
the Root <br>
&gt; &gt; element can't be matched against the one defined in the schema.<br>
&gt; &gt; My schema is now:<br>
&gt; &gt; <br>
&gt; &gt; &lt;xs:schema &nbsp;xmlns:xs=&quot;http://www.w3.org/2001/XMLSchema&quot;
&nbsp; &nbsp; &nbsp; &nbsp;<br>
&gt; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; version=&quot;0.9&quot; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br>
&gt; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; targetNamespace=&quot;http://www.mynamespace.com&quot;<br>
&gt; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; xmlns=&quot;http://www.mynamespace.com&quot;<br>
&gt; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; elementFormDefault=&quot;qualified&quot;&gt;<br>
&gt; &gt; <br>
&gt; &gt; &nbsp; &lt;xs:element name=&quot;Root&quot;&gt;<br>
&gt; &gt; &nbsp; &nbsp; &lt;xs:complexType&gt;<br>
&gt; &gt; &nbsp; &nbsp; &nbsp; &nbsp; blah...<br>
&gt; &gt; <br>
&gt; &gt; <br>
&gt; &gt; My instance document begins:<br>
&gt; &gt; <br>
&gt; &gt; &lt;Root xmlns=&quot;http://www.mynamespace.com&quot;&gt;<br>
&gt; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt;blah&gt;<br>
&gt; &gt; <br>
&gt; &gt; <br>
&gt; &gt; And my code reads:<br>
&gt; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DocumentBuilderFactory
factory = <br>
&gt; &gt; DocumentBuilderFactory.newInstance(); &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp;<br>
&gt; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *if*(schemaLocation
!= *null*) {<br>
&gt; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; factory.setNamespaceAware(*true*);<br>
&gt; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; factory.setValidating(*true*);<br>
&gt; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br>
&gt; &gt; factory.setAttribute(&quot;http://apache.org/xml/features/validation/schema&quot;,
<br>
&gt; &gt; Boolean.TRUE);<br>
&gt; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br>
&gt; &gt; factory.setAttribute(&quot;http://apache.<br>
&gt; org/xml/properties/dom/document-class-name&quot;, <br>
&gt; &gt; &quot;org.apache.xerces.dom.PSVIDocumentImpl&quot;);<br>
&gt; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br>
&gt; &gt; &nbsp;factory.setAttribute(&quot;http://apache.<br>
&gt; org/xml/properties/schema/external-schemaLocation&quot;, <br>
&gt; &gt; schemaLocation);<br>
&gt; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br>
&gt; &gt; <br>
&gt; &gt; Where schemaLocation is &quot;http://www.mynamespace.com <br>
&gt; &gt; conf/BDM-FDDNUServletRequest.xsd&quot;<br>
&gt; &gt; <br>
&gt; &gt; The schema location worked when I set it as the value of the
property <br>
&gt; &gt; &quot;http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation<br>
&gt; &quot;, <br>
&gt; &gt; so presumably the parser's still finding the schema.<br>
&gt; &gt; <br>
&gt; &gt; If I was specifiying a schema within an instance document I'd
use <br>
&gt; &gt; something like this:<br>
&gt; &gt; <br>
&gt; &gt; &lt;Root &nbsp;xmlns=&quot;http://www.mynamespace.com&quot;<br>
&gt; &gt; &nbsp; &nbsp; &nbsp; &nbsp; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;<br>
&gt; &gt; &nbsp; &nbsp; &nbsp; &nbsp; xsi:schemaLocation=&quot;http://www.mynamespace.com
FormsSchema.xsd&quot;&gt;<br>
&gt; &gt; <br>
&gt; &gt; Does setting the &quot;external-schemaLocation&quot; property
on Xerces avoid the <br>
&gt; &gt; need for me to have to set the second of these three properties?<br>
&gt; &gt; <br>
&gt; &gt; What final connecting element am I still missing?<br>
&gt; &gt; <br>
&gt; &gt; <br>
&gt; &gt; Thanks again for your time,<br>
&gt; &gt; <br>
&gt; &gt; John<br>
&gt; &gt; <br>
&gt; &gt; <br>
&gt; &gt; <br>
&gt; &gt; <br>
&gt; &gt; <br>
&gt; &gt; Michael Glavassevich &lt;mrglavas@ca.ibm.com&gt; wrote on 14/01/2005
09:45:07 AM:<br>
&gt; &gt; <br>
&gt; &gt; &nbsp;&gt; Hello John,<br>
&gt; &gt; &nbsp;&gt;<br>
&gt; &gt; &nbsp;&gt; The value of the external-schemaLocation property
is a list of pairs of<br>
&gt; &gt; &nbsp;&gt; URIs (just like the xsi:schemaLocation attribute [1]),
where the <br>
&gt; &gt; first of<br>
&gt; &gt; &nbsp;&gt; each pair is a target namespace and the second of
each pair is a schema<br>
&gt; &gt; &nbsp;&gt; location hint. Did you specify the target namespace
before the location<br>
&gt; &gt; &nbsp;&gt; &quot;conf/BDM-FDDNUServletRequest.xsd&quot;? If not,
that probably explains <br>
&gt; &gt; why you<br>
&gt; &gt; &nbsp;&gt; get the error.<br>
&gt; &gt; &nbsp;&gt;<br>
&gt; &gt; &nbsp;&gt; Thanks.<br>
&gt; &gt; &nbsp;&gt;<br>
&gt; &gt; &nbsp;&gt; [1] http://www.w3.org/TR/2004/REC-xmlschema-1-20041028/#schema-loc<br>
&gt; &gt; &nbsp;&gt;<br>
&gt; &gt; &nbsp;&gt; John_Greenhow@agd.nsw.gov.au wrote on 01/12/2005 01:15:59
AM:<br>
&gt; &gt; &nbsp;&gt;<br>
&gt; &gt; &nbsp;&gt; &gt;<br>
&gt; &gt; &nbsp;&gt; &gt; Hi,<br>
&gt; &gt; &nbsp;&gt; &gt;<br>
&gt; &gt; &nbsp;&gt; &gt; Apologies if this is an FAQ, I've read a thread
in the archive that<br>
&gt; &gt; &nbsp;&gt; &gt; seems to match my problem but I can't get the
fix to work. &nbsp;The<br>
&gt; &gt; &nbsp;&gt; &gt; thread was entitled &quot;Validation fails with
targetNamespace ==<br>
&gt; &gt; &nbsp;&gt; &gt; default&quot; and lives at: &nbsp;http://mail-archives.apache.<br>
&gt; &gt; &nbsp;&gt; &gt; org/eyebrowse/ReadMsg?listId=85&amp;msgNo=2861<br>
&gt; &gt; &nbsp;&gt; &gt;<br>
&gt; &gt; &nbsp;&gt; &gt; I'm attempting to add a namespace to a schema
and instance documents<br>
&gt; &gt; &nbsp;&gt; &gt; that I'm validating on a servlet.<br>
&gt; &gt; &nbsp;&gt; &gt;<br>
&gt; &gt; &nbsp;&gt; &gt; I have something like the following as my schema:<br>
&gt; &gt; &nbsp;&gt; &gt;<br>
&gt; &gt; &nbsp;&gt; &gt; &lt;xs:schema &nbsp;xmlns:xs=&quot;http://www.w3.org/2001/XMLSchema&quot;<br>
&gt; &gt; &nbsp;&gt; &gt; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-Instance&quot;<br>
&gt; &gt; &nbsp;&gt; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; version=&quot;0.9&quot;<br>
&gt; &gt; &nbsp;&gt; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; targetNamespace=&quot;http://www.mynamespace.com/&quot;<br>
&gt; &gt; &nbsp;&gt; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xmlns=&quot;http://www.mynamespace.com/&quot;<br>
&gt; &gt; &nbsp;&gt; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; elementFormDefault=&quot;qualified&quot;&gt;<br>
&gt; &gt; &nbsp;&gt; &gt;<br>
&gt; &gt; &nbsp;&gt; &gt; &nbsp; &lt;xs:element name=&quot;Root&quot;&gt;<br>
&gt; &gt; &nbsp;&gt; &gt; &nbsp; &nbsp; &lt;xs:complexType&gt;<br>
&gt; &gt; &nbsp;&gt; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;xs:choice&gt;<br>
&gt; &gt; &nbsp;&gt; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; blah blah blah..<br>
&gt; &gt; &nbsp;&gt; &gt;<br>
&gt; &gt; &nbsp;&gt; &gt;<br>
&gt; &gt; &nbsp;&gt; &gt;<br>
&gt; &gt; &nbsp;&gt; &gt; I have an instance document like this:<br>
&gt; &gt; &nbsp;&gt; &gt;<br>
&gt; &gt; &nbsp;&gt; &gt; &lt;Root xmlns=&quot;http://www.mynamespace.com/&quot;&gt;&lt;blah
blah blah..<br>
&gt; &gt; &nbsp;&gt; &gt;<br>
&gt; &gt; &nbsp;&gt; &gt;<br>
&gt; &gt; &nbsp;&gt; &gt; And I'm attempting to set up validation using
the following code<br>
&gt; &gt; &nbsp;&gt; &gt; (and Xerces 2.6.0) :<br>
&gt; &gt; &nbsp;&gt; &gt;<br>
&gt; &gt; &nbsp;&gt; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DocumentBuilderFactory
factory = DocumentBuilderFactory.<br>
&gt; &gt; &nbsp;&gt; &gt; newInstance();<br>
&gt; &gt; &nbsp;&gt; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(schemaLocation
!= null) {<br>
&gt; &gt; &nbsp;&gt; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; factory.setNamespaceAware(true);<br>
&gt; &gt; &nbsp;&gt; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; factory.setValidating(true);<br>
&gt; &gt; &nbsp;&gt; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; factory.setAttribute(&quot;http://apache.<br>
&gt; &gt; &nbsp;&gt; &gt; org/xml/features/validation/schema&quot;, Boolean.TRUE);<br>
&gt; &gt; &nbsp;&gt; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; factory.setAttribute(&quot;http://apache.<br>
&gt; &gt; &nbsp;&gt; &gt; org/xml/properties/dom/document-class-name&quot;,
&quot;org.apache.xerces.dom.<br>
&gt; &gt; &nbsp;&gt; &gt; PSVIDocumentImpl&quot;);<br>
&gt; &gt; &nbsp;&gt; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; factory.setAttribute(&quot;http://apache.<br>
&gt; &gt; &nbsp;&gt; &gt; org/xml/properties/schema/external-schemaLocation&quot;,
schemaLocation);<br>
&gt; &gt; &nbsp;&gt; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br>
&gt; &gt; &nbsp;&gt; &gt;<br>
&gt; &gt; &nbsp;&gt; &gt;<br>
&gt; &gt; &nbsp;&gt; &gt; I think I've done everything in the checklist
mentioned in the<br>
&gt; &gt; &nbsp;&gt; &gt; archived thread:<br>
&gt; &gt; &nbsp;&gt; &gt;<br>
&gt; &gt; &nbsp;&gt; &gt; a) Defined targetNamespace and elementFormDefault
on my schema.<br>
&gt; &gt; &nbsp;&gt; &gt; b) Use namespace defaulting for unprefixed elements
in my instance<br>
&gt; &gt; &nbsp;&gt; document.<br>
&gt; &gt; &nbsp;&gt; &gt; c) Tell the parser the location of the schema
(say, &quot;conf/BDM-<br>
&gt; &gt; &nbsp;&gt; &gt; FDDNUServletRequest.xsd&quot; ).<br>
&gt; &gt; &nbsp;&gt; &gt;<br>
&gt; &gt; &nbsp;&gt; &gt;<br>
&gt; &gt; &nbsp;&gt; &gt; However, validation is failing with the following
error:<br>
&gt; &gt; &nbsp;&gt; &gt;<br>
&gt; &gt; &nbsp;&gt; &gt; Failed validation with the following errors:<br>
&gt; &gt; &nbsp;&gt; &gt; Illegal XML: http://www.w3.org/TR/xml-schema-1#SchemaLocation?<br>
&gt; &gt; &nbsp;&gt; &gt; /usr/local/jakarta-tomcat-5.0.18/webapps/BDM-OsirisServer/conf/BDM-<br>
&gt; &gt; &nbsp;&gt; &gt; FDDNUServerRequest.xsd<br>
&gt; &gt; &nbsp;&gt; &gt; Illegal XML: cvc-elt.1: Cannot find the declaration
of element 'Root'.<br>
&gt; &gt; &nbsp;&gt; &gt;<br>
&gt; &gt; &nbsp;&gt; &gt;<br>
&gt; &gt; &nbsp;&gt; &gt; Does this mean that it either can't find the
schema because the<br>
&gt; &gt; &nbsp;&gt; &gt; namespace it's using is<br>
&gt; &gt; &nbsp;&gt; &quot;http://www.w3.org/TR/xml-schema-1#SchemaLocation<br>
&gt; &gt; &nbsp;&gt; &gt; &quot; instead of the default one mentioned in
the instance document?<br>
&gt; &gt; &nbsp;&gt; &gt;<br>
&gt; &gt; &nbsp;&gt; &gt; Or does it mean that it's found the schema and
I've missed something<br>
&gt; &gt; &nbsp;&gt; &gt; in my instance document?<br>
&gt; &gt; &nbsp;&gt; &gt;<br>
&gt; &gt; &nbsp;&gt; &gt; Any hints, pointers or tips as how to get this
to validate would be<br>
&gt; &gt; &nbsp;&gt; &gt; gratefully appreciated.<br>
&gt; &gt; &nbsp;&gt; &gt;<br>
&gt; &gt; &nbsp;&gt; &gt; Thanks for your time,<br>
&gt; &gt; &nbsp;&gt; &gt;<br>
&gt; &gt; &nbsp;&gt; &gt; John Greenhow<br>
&gt; &gt; &nbsp;&gt; &gt;<br>
&gt; &gt; &nbsp;&gt;<br>
&gt; &gt; &nbsp;&gt; Michael Glavassevich<br>
&gt; &gt; &nbsp;&gt; XML Parser Development<br>
&gt; &gt; &nbsp;&gt; IBM Toronto Lab<br>
&gt; &gt; &nbsp;&gt; E-mail: mrglavas@ca.ibm.com<br>
&gt; &gt; &nbsp;&gt; E-mail: mrglavas@apache.org<br>
&gt; <br>
&gt; <br>
&gt; ---------------------------------------------------------------------<br>
&gt; To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org<br>
&gt; For additional commands, e-mail: xerces-j-user-help@xml.apache.org<br>
&gt; <br>
</tt></font>
<P>&nbsp;</P>

--=_alternative 007AEECACA256F8C_=--
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic