[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

(more details) embedding xml schema in an instance doc


embedding schema in xml
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.

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.