Altova Mailing List Archives


RE: Validation with multiple schemas

From: "Priscilla Walmsley" <priscilla@--------.--->
To: <daves.subscriptions@---------.--->, <xmlschema-dev@--.--->
Date: 8/13/2002 9:25:00 AM
Hi Dave,

Your instance is using an old namespace - it should be "2001" instead of
"2000/10", like this:

> t.xml:
> <?xml version="1.0" encoding="UTF-8"?>
> <foo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
> xmlns="t" xsi:schemaLocation="t t.xsd s s.xsd" xmlns:s="s" 
> s:type="bar"/>
 

Hope that helps,
Priscilla
-----------------------------------------------------
Priscilla Walmsley             priscilla@w...
Author, Definitive XML Schema     (Prentice Hall PTR)
----------------------------------------------------- 

> -----Original Message-----
> From: xmlschema-dev-request@w... 
> [mailto:xmlschema-dev-request@w...] On Behalf Of 
> daves.subscriptions@S...
> Sent: Monday, August 12, 2002 4:05 PM
> To: xmlschema-dev@w...
> Subject: Validation with multiple schemas
> 
> 
> 
> 
> 
> 
> I am trying to get a parser to validate an XML file that uses 
> a schema which includes another schema definition.  All I 
> want to do is define an attribute in one schema/namespace and 
> reference it as a required attribute in another schema.  I've 
> simplified the example to 3 files: t.xsd includes s.xsd, and 
> t.xml is my instance doc.
> 
> t.xsd (define element foo that requires s:type attribute):
> <?xml version="1.0" encoding="UTF-8"?>
> <xsd:schema targetNamespace="t" xmlns:s="s" 
> xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
> attributeFormDefault="unqualified">
> 	<xsd:import namespace="s" schemaLocation="s.xsd"/>
> 	<xsd:element name="foo">
> 		<xsd:complexType>
> 			<xsd:attribute ref="s:type" use="required"/>
> 		</xsd:complexType>
> 	</xsd:element>
> </xsd:schema>
> 
> s.xsd:
> <?xml version="1.0"?>
> <xsd:schema targetNamespace="s" 
> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> 	<xsd:attribute name="type" type="xsd:string"/>
> </xsd:schema>
> 
> t.xml:
> <?xml version="1.0" encoding="UTF-8"?>
> <foo xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance" 
> xmlns="t" xsi:schemaLocation="t t.xsd s s.xsd" xmlns:s="s" 
> s:type="bar"/>
> 
> If you read this far, thanks a lot.
> 
> XMLSpy">XMLSpy 4.4 says it is valid and Xerces 2.0.2 doesn't complain:
> 
> java -cp 
> c:\xerces\xerces-2_0_2\xercesImpl.jar;c:\xerces\xerces-2_0_2\x
> ercesSamples.jar;c:\xerces\xerces-2_0_2\xmlParserAPIs.jar 
> sax.Counter -dv -s -v t.xml
> t.xml: 541 ms (1 elems, 1 attrs, 0 spaces, 0 chars)
> 
> (Note: I had to use -dv and -s along with -v or I would get errors)
> 
> If I remove s:type="bar" from t.xml, though, XMLSpy">XMLSpy 
> correctly says it is invalid while Xerces is still silent.
> 
> If you think this is really just a Xerces bug, I will ask 
> somewhere else, but I'm more worried that I'm doing something 
> fundamentally wrong.
> 
> If there is another parser/version that I could use to test 
> my validation, I'd appreciate the tip also.
> 
> Thanks for any insights,
> -- Dave
> 
> 
> 

From xmlschema-dev-request@t... Tue Aug 13 13:44:09 2002
Received: from tux.w3.org (tux.w3.org [18.29.0.27])
	by fr

Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.