- From: Jeni Tennison <jeni@jenitennison.com>
- Date: Thu, 24 Jul 2003 15:38:31 +0100
- To: "Catalin VLAD" <catalin@ean.ro>
- CC: xmlschema-dev@w3.org
Hi Catalin, > This files was all validated with Schema by XML Spy 5.0. XML Spy's XSD implementation is not conformant. You should send them a bug report. > 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). The <additionalItemName> element is declared with a local declaration in 3.xsd. When you declare an element locally, the namespace for the element is either the target namespace for the schema or no namespace; it depends on the "form" for the element declaration. Since you have no form attribute on the <xs:element> element declaration, the "form" comes from the elementFormDefault attribute on the <xs:schema> element. In this case, it's 'unqualified', which means that the <additionalItemName> element is in no namespace. If you want the <additionalItemName> element to be in the core namespace (the target namespace for 3.xsd), then you should set the elementFormDefault attribute on the <xs:schema> element to 'qualified' or add a 'form' attribute to the <xs:element> element with the value 'qualified'. > Can I write a simple XSD file(just 1 file - not 3 files as above) > that validate my XML file ? Not to give you good validation; part of the design of XSD dictates that elements in different namespaces must be declared in different files. Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/
Received on Thursday, 24 July 2003 10:38:39 UTC