OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   (more details) embedding xml schema in an instance doc

[ Lists Home | Date Index | Thread Index ]

I posted a few days ago but with little detail...I thought providing more details would help.

What I'm attempting to do is embed a "fragment" of XML Schema within an XML instance document.  Refer to:

http://digir.sourceforge.net/prot/beta3/requestExample.xml

You'll notice, toward the bottom of the document, the element <structure> which contains some XML Schema (elements from the Schema grammar).  XMLSpy
has no problem with this instance document, and neither does whatever parser/validator exists within the browser.  However, when I use this document within my java application, Xerces errors.  If I use the document with the header as you see here, I get the following:   

Parsing Error on Line: 21 (General Schema Error: Grammar with uri: http://www.w3.org/2001/XMLSchema , can not be found; schema namespace may be wrong:  Xerces supports schemas from the "http://www.w3.org/2001/XMLSchema";
namespace or the instance document's namespace may not match the targetNamespace of the schema.)
(org.xml.sax.SAXParseException: General Schema Error: Grammar with uri: http://www.w3.org/2001/XMLSchema , can not be found; schema namespace may be wrong:  Xerces supports schemas from the "http://www.w3.org/2001/XMLSchema";
namespace or the instance document's namespace may not match the targetNamespace of the schema.)                                                

This seems to say to me it can't find the grammar for XMLSchema and/or the parser isn't sure if its dealing with an instance document or a schema 
document.  So if I modify the document to supply the schemaLocation for the xsd as so:

<request xmlns="http://www.namespaceTBD.org/digir";         xmlns:darwin="http://www.namespaceTBD.org/darwin2"xmlns:xsd="http://www.w3.org/2001/XMLSchema";      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";                        
xsi:schemaLocation="http://www.namespaceTBD.org/digir http://digir.sourceforge.net/prot/beta3/digir.xsd http://www.namespaceTBD.org/darwin2 http://digir.sourceforge.net/fed/beta3/darwin2.xsd http://www.w3.org/2001/XMLSchema http://www.w3.org/2001/XMLSchema.xsd";>                    
I get the following error:

Parsing Error on Line: 5 (Unknown base type  for type reducedDerivationControl. (org.xml.sax.SAXParseException: Unknown base type  for type reducedDerivationControl.)

The latter error here seems to come from Xerces being unable to validate the actual schema for XMLSchema.  Looking over that schema,   
reducedDerivationControl extends from derivationControl and both types are defined within the schema.                                                      
So what I'm wondering, outside of whether I should be able to do this or not, is whether the schema for XMLSchema should be able to be validated...or am I possibly uncovering a flaw with Xerces?  Is there something basic I'm 
overlooking in my namespace specifications in my documents?  It seems to me that the XMLSchema namespace *should* be able to be viewed as any other namespace from an instance document perspective.  Does this seem like blatently wrong thinking on my part?                                            

Any advice would be greatly appreciated!

Thanks in advance,
P.J.




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS