- From: Catalin VLAD <catalin@ean.ro>
- Date: Thu, 24 Jul 2003 17:21:32 +0300
- To: <xmlschema-dev@w3.org>
I resend it (formated). Hello, I have 3 big xsd files. The problem is that I cann't validate an xml sample using JAXP1.2. Also I tryed with JAXB and Castor but seems to be the same problem. I made an simple example in 3 files that generate the error: 1.xsd - this is the main file <?xml version="1.0" encoding="UTF-8"?> <xsd:schema targetNamespace="http://www.example.com/response" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:fmcg="http://www.example.com/fmcg" xmlns:core="http://www.example.com/core" xmlns="http://www.example.com/response" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xsd:import namespace="http://www.example.com/fmcg" schemaLocation="2.xsd"/> <xsd:element name="response" type="ResponseType"/> <xsd:complexType name="ResponseType"> <xsd:sequence> <xsd:element name="senderName" type="xsd:string"/> <xsd:element ref="fmcg:item" minOccurs="0" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> </xsd:schema> 2.xsd <?xml version="1.0" encoding="UTF-8"?><xsd:schema targetNamespace="http://www.example.com/fmcg" xmlns:core="http://www.example.com/core" xmlns="http://www.example.com/fmcg" xmlns:fmcg="http://www.example.com/fmcg" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xsd:import namespace="http://www.example.com/core" schemaLocation="3.xsd"/> <xsd:element name="item" type="ItemType"/> <xsd:complexType name="ItemType"> <xsd:complexContent> <xsd:extension base="core:ItemType"> <xsd:sequence> <xsd:element name="itemName" type="xsd:string"/> </xsd:sequence> </xsd:extension> </xsd:complexContent> </xsd:complexType> </xsd:schema> 3.xsd <?xml version="1.0" encoding="UTF-8"?><xsd:schema targetNamespace="http://www.example.com/core" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.example.com/core" elementFormDefault="unqualified" attributeFormDefault="unqualified"> <xsd:complexType name="ItemType" abstract="true"> <xsd:sequence> <xsd:element name="additionalItemName" type="xsd:string" minOccurs="0"/> </xsd:sequence> </xsd:complexType> </xsd:schema> And this is a sample xml file: <?xml version="1.0" encoding="UTF-8"?><response xmlns="http://www.example.com/response" xmlns:core="http://www.example.com/core" xmlns:fmcg=http://www.example.com/fmcg > <senderName>String</senderName> <fmcg:item> <core:additionalItemName>String</core:additionalItemName> <fmcg:itemName>String</fmcg:itemName> </fmcg:item> </response> This files was all validated with Schema by XML Spy 5.0. When I try to validate this XML file with JAXP1.2 I got this ERROR: (file:test.xml: 7, 28): cvc-complex-type.2.4.a: Invalid content starting with element 'core:additionalItemName'. One of '{"":additionalItemName, "http://www.example.com/fmcg":itemName}' is expected. It seems that the parser expects 'additionalItemName' instead of 'core:additionalItemName'. Why ? I think the namespace is OK.(Also I tryed with Castor and JAXB and seems to have the same error). Also I tryed to generate a XSD schema with XML Spy 5.0 from the sample XML file but the Schema generated was INVALID. Why is something wrong with my files? Can I write a simple XSD file(just 1 file - not 3 files as above) that validate my XML file ? Regards, Catalin
Received on Thursday, 24 July 2003 10:21:31 UTC