Hi, I'm using Xerces 1.4.4 and trying to validate a very simple test case of multiple namespaces across multiple schemas. In this example, I've got two base schemas (Product.xsd and Person.xsd) being used by a third (Company.xsd).
This is actually an example taken verbatim from www.xfront.com. Eyeballing the schemas and instances, I can't find what's wrong and why the Company element is not being found valid. Any help would be appreciated. Thanks, Andy Product.xsd-------------------------------------------- <?xml version="1.0"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.product.org" xmlns="http://www.product.org" elementFormDefault="unqualified"> <xsd:complexType name="ProductType"> <xsd:sequence> <xsd:element name="Type" type="xsd:string"/> </xsd:sequence> </xsd:complexType> </xsd:schema> Person.xsd-------------------------------------------- <?xml version="1.0"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.person.org" xmlns="http://www.person.org" elementFormDefault="unqualified"> <xsd:complexType name="PersonType"> <xsd:sequence> <xsd:element name="Name" type="xsd:string"/> <xsd:element name="SSN" type="xsd:string"/> </xsd:sequence> </xsd:complexType> </xsd:schema> Company.xsd-------------------------------------------- <?xml version="1.0"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.company.org" xmlns="http://www.company.org" elementFormDefault="unqualified" xmlns:per="http://www.person.org" xmlns:pro="http://www.product.org"> <xsd:import namespace="http://www.person.org" schemaLocation="Person.xsd"/> <xsd:import namespace="http://www.product.org" schemaLocation="Product.xsd"/> <xsd:element name="Company"> <xsd:complexType> <xsd:sequence> <xsd:element name="Person" type="per:PersonType" maxOccurs="unbounded"/> <xsd:element name="Product" type="pro:ProductType" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema> company.xml-------------------------------------------- <?xml version="1.0"?> <Company xmlns="http://www.company.org" xmlns:pro="http://www.product.org" xmlns:per="http://www.person.org" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation= "http://www.company.org Company.xsd"> <Person> <per:Name>John Doe</per:Name> <per:SSN>123-45-6789</per:SSN> </Person> <Product> <pro:Type>Widget</pro:Type> </Product> </Company> Execution:--------------------------------------------- java sax.SAXCount -v -n -s -p org.apache.xerces.par sers.SAXParser company.xml The output:-------------------------------------------- [Error] company.xml:9:17: Element type "Person" must be declared. [Error] company.xml:10:27: Element type "per:Name" must be declared. [Error] company.xml:11:26: Element type "per:SSN" must be declared. [Error] company.xml:13:18: Element type "Product" must be declared. [Error] company.xml:14:27: Element type "pro:Type" must be declared. [Error] company.xml:16:12: The content of element type "Company" must match "(Pe rson+,Product+)". company.xml: 547 ms (6 elems, 5 attrs, 19 spaces, 94 chars) ______________________________________________________ Send your holiday cheer with http://greetings.yahoo.ca --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
