[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Problem with cascading XML Schemas
For maximum scalability I want to use cascading xml schemas; for example one schema for basic datatypes (schema A), one for a group of applications (schema B) and one for the application itself (schema C). To keep everything clearly laid out, I'd prefer every schema to have it's own namespace. However, if I import schema A into schema B and then import schema B into schema C, I can't access schema A's datatypes from schema C. If I import schema A into schema B and then import schema A _and_ schema B into schema C, I get an validation error in schema C ("Warning - one of the grammar(s) returned from the user's grammar pool is in conflict with another grammar"). SCHEMA A (schema_basic.xsd): <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns = "http://www.acme.org/basic" targetNamespace = "http://www.acme.org/basic" xmlns:xs = "http://www.w3.org/2001/XMLSchema"> <xs:simpleType name="smallRange"> <xs:restriction base="xs:integer"> <xs:minInclusive value="2"/> <xs:maxInclusive value="5"/> </xs:restriction> </xs:simpleType> </xs:schema> SCHEMA B (schema_extended.xsd): <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:basic = "http://www.acme.org/basic" xmlns = "http://www.acme.org/extended" targetNamespace = "http://www.acme.org/extended" xmlns:xs = "http://www.w3.org/2001/XMLSchema"> <xs:import namespace="http://www.acme.org/basic" schemaLocation="schema_basic.xsd"/> <xs:simpleType name="extendedRange"> <xs:union memberTypes="basic:smallRange"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="more"/> </xs:restriction> </xs:simpleType> </xs:union> </xs:simpleType> </xs:schema> SCHEMA C (schema.xsd): <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:basic = "http://www.acme.org/basic" xmlns:ext = "http://www.acme.org/extended" xmlns = "http://www.acme.org/specific" targetNamespace = "http://www.acme.org/specific" xmlns:xs = "http://www.w3.org/2001/XMLSchema"> <xs:import namespace="http://www.acme.org/basic" schemaLocation="schema_basic.xsd"/> <xs:import namespace="http://www.acme.org/extended" schemaLocation="schema_extended.xsd"/> <xs:element name="quantities"> <xs:complexType> <xs:sequence> <xs:element name="quantity" type="basic:smallRange"/> <xs:element name="large_quantity" type="ext:extendedRange"/> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> What's my mistake here? What would be a sensible approach when I want to keep schema A, B and C in different namespaces? Thank you very much Thorsten Rock
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] |
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|