[
https://issues.apache.org/jira/browse/XERCESJ-819?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Michael Glavassevich reassigned XERCESJ-819:
--------------------------------------------
Assignee: Michael Glavassevich (was: Xerces-J Developers Mailing List)
> Contradictory validation messages
> ---------------------------------
>
> Key: XERCESJ-819
> URL: https://issues.apache.org/jira/browse/XERCESJ-819
> Project: Xerces2-J
> Issue Type: Bug
> Components: XML Schema Structures
> Affects Versions: 2.5.0
> Environment: Operating System: All
> Platform: All
> Reporter: George Cristian Bina
> Assignee: Michael Glavassevich
>
> Taking a schema for a target namespace that defines an attribute and an
> element
> containing it (both belonging to the target namespace):
> [testAtt.xsd]
> <?xml version="1.0" encoding="UTF-8"?>
> <xsd:schema targetNamespace="http://www.oxygenxml.com/test"
> xmlns="http://www.oxygenxml.com/test"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> <xsd:attribute name="att" type="xsd:string"/>
> <xsd:element name="elem">
> <xsd:complexType>
> <xsd:attribute ref="att" use="required"/>
> </xsd:complexType>
> </xsd:element>
> </xsd:schema>
> and creating an invalid document that instead of specifying the attribute in
> the target namespace specifies it in no namespace:
> [testAtt.xml]
> <?xml version="1.0" encoding="UTF-8"?>
> <elem xmlns="http://www.oxygenxml.com/test"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://www.oxygenxml.com/test testAtt.xsd"
> att="1234"></elem>
> The error messages are:
> E cvc-complex-type.3.2.2: Attribute 'att' is not allowed to appear in
> element 'elem'.
> E cvc-complex-type.4: Attribute 'att' must appear on element 'elem'.
> The problem is the second message that should better say something like:
> Attribute 'att' from namespace 'http://www.oxygenxml.com/test' must appear on
> element 'elem'.
> The relevant parts from the sources are:
> class XMLSchemaValidator
> method addDefaultAttributes
> from 2814 to 2816
> reportSchemaError(
> "cvc-complex-type.4",
> new Object[] { element.rawname, currDecl.fName });
> and
> file XMLSchemaMessages.properties
> line 49
> cvc-complex-type.4 = cvc-complex-type.4: Attribute ''{1}'' must appear on
> element ''{0}''.
> One possible solution will be pass the namespace as another parameter to the
> message, something like below:
> reportSchemaError(
> "cvc-complex-type.4",
> new Object[] { element.rawname, currDecl.fName,
> currDecl.fTargetNamespace });
> cvc-complex-type.4 = cvc-complex-type.4: Attribute ''{1}'' from
> namespace ''{2}''must appear on element ''{0}''.
--
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]