XML Schema: improved error reporting with namespace qualified elements
----------------------------------------------------------------------
Key: XERCESJ-1486
URL: https://issues.apache.org/jira/browse/XERCESJ-1486
Project: Xerces2-J
Issue Type: Improvement
Affects Versions: 2.11.0
Reporter: Mukul Gandhi
Assignee: Mukul Gandhi
Priority: Minor
Please consider following example.
temp.xml
<X xmlns="http://xyz">
<a>hello world</a>
<b>hello world ..</b>
<c/>
</X>
temp.xsd
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://xyz" xmlns:ns1="http://xyz1"
elementFormDefault="qualified">
<xs:import namespace="http://xyz1" schemaLocation="temp1.xsd" />
<xs:element name="X">
<xs:complexType>
<xs:sequence>
<xs:element name="a" type="xs:string" />
<xs:element name="b" type="xs:string" form="unqualified"/>
<xs:element ref="ns1:c" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
temp1.xsd
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://xyz1" elementFormDefault="qualified">
<xs:element name="c" type="xs:string" />
</xs:schema>
When the XML document temp.xml is validated by the schema document temp.xsd,
Xerces currently reports an error message as following:
[Error] temp.xml:3:6: cvc-complex-type.2.4.a: Invalid content was found
starting with element 'b'. One of '{b}' is expected.
Since the element "b" is in a namespace I thought an error message like
following would probably be more appropriate (i.e qualify element descriptions
with namespace URIs for non null namespace URIs):
[Error] temp.xml:3:6: cvc-complex-type.2.4.a: Invalid content was found
starting with element '{"http://xyz":b}'. One of '{b}' is expected.
I've written a patch that makes this improvement and would be committing it
asap.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]