[ 
https://issues.apache.org/jira/browse/XERCESC-1441?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Scott Cantor updated XERCESC-1441:
----------------------------------
    Fix Version/s:     (was: 2.9.0)

> QNameDatatypeValidator does not resolve namespaces when making comparisions
> ---------------------------------------------------------------------------
>
>                 Key: XERCESC-1441
>                 URL: https://issues.apache.org/jira/browse/XERCESC-1441
>             Project: Xerces-C++
>          Issue Type: Bug
>          Components: Validating Parser (XML Schema)
>    Affects Versions: 2.6.0
>         Environment: Linux 2.4.21-27 i686 GNU/Linux
> gcc (GCC) 3.2.3 20030502 (Red Hat Linux 3.2.3-49)
>            Reporter: Alex Dickinson
>            Assignee: cargilld
>            Priority: Major
>             Fix For: 3.0.0
>
>         Attachments: QnameTest.cpp, qname-bad.xml, qname-good.xml, qname.xsd
>
>
> Xerces-C can not properly validate  enumerations with a QName base.It will 
> validate only if the enumeration's QName's prefix is exactly the same as the 
> namespace prefix defined in the XSD.
> For example, the schema is defined as:
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
>           xmlns:tns="http://www.example.com/qname";
>           xmlns:xml="http://www.w3.org/XML/1998/namespace";
>           targetNamespace="http://www.example.com/qname";
>         elementFormDefault="qualified" > ...
> (the full schema is included below)
> Then the XML document will validate (using same namespace prefix):
> <tns:Body xmlns:tns="http://www.example.com/qname";
>              xmlns:xml="http://www.w3.org/XML/1998/namespace";>
>  <tns:Fault>
>    <tns:Code>
>       <tns:Value>tns:Sender</tns:Value>
>    </tns:Code>
>  </tns:Fault>
> </tns:Body>
> But the following will not (using a different namespace prefix):
> <my-tns:Body xmlns:my-tns="http://www.example.com/qname";
>              xmlns:xml="http://www.w3.org/XML/1998/namespace";>
>  <my-tns:Fault>
>    <my-tns:Code>
>       <my-tns:Value>my-tns:Sender</my-tns:Value>
>    </my-tns:Code>
>  </my-tns:Fault>
> </my-tns:Body>
> I have tracked the root of this problem down to 
> trunk/src/xercesc/validators/datatype/QNameDatatypeValidator.cpp line 185:
>        for ( ; i < enumLength; i++)
>        {
>            if (XMLString::equals(normContent, getEnumeration()->elementAt(i)))
>                break;
>        }
>        if (i == enumLength)
>            ThrowXMLwithMemMgr1(InvalidDatatypeValueException, 
> XMLExcepts::VALUE_NotIn_Enumeration, content, manager);
> The comparison XMLString::equals is comparing the QName string with the URI 
> prefix (i.e. tns:Sender) instead of the the URI itself (i.e. 
> {http://www.example.com/qname}:Sender). So if the XML uses a different 
> namespace prefix than that of the schema definition, it will fail. 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscr...@xerces.apache.org
For additional commands, e-mail: c-dev-h...@xerces.apache.org

Reply via email to