You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by "cargilld (JIRA)" <xe...@xml.apache.org> on 2005/08/26 17:54:27 UTC
[jira] Resolved: (XERCESC-1240) xml:lang attribute is not validated
[ http://issues.apache.org/jira/browse/XERCESC-1240?page=all ]
cargilld resolved XERCESC-1240:
-------------------------------
Resolution: Fixed
Hi,
I checked in a fix for this.
David
> xml:lang attribute is not validated
> -----------------------------------
>
> Key: XERCESC-1240
> URL: http://issues.apache.org/jira/browse/XERCESC-1240
> Project: Xerces-C++
> Type: Bug
> Components: Validating Parser (Schema) (Xerces 1.5 or up only)
> Versions: 2.5.0
> Environment: Windows XP, Visual C++ 6
> Reporter: Alberto Massari
>
> Given this XSD
> <?xml version="1.0"?>
> <xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
> <!--Import for xml:lang and xml:space-->
> <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd"/>
> <xs:element name="root">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="tag" type="xs:string"/>
> </xs:sequence>
> <xs:attribute name="attr" type="xs:string" use="required"/>
> <xs:attribute ref="xml:lang" use="required"/>
> </xs:complexType>
> </xs:element>
> </xs:schema>
> that imports the "xml" namespace and requires the xml:lang attribute to be specified on the root element, and given this XML
> <?xml version="1.0"?>
> <root attr="1" xml:lang="en" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="xmllang.xsd">
> <tag/>
> </root>
> that does specify the attribute, the command
> SAXPrint -n -s xmllang.xml
> reports:
> Error at file xmllang.xml, line 3, char 46
> Message: Required attribute 'lang' was not provided
> The cause for this is in IGXMLScanner2.cpp, line 206
> // If the uri comes back as the xmlns or xml URI or its just a name
> // and that name is 'xmlns', then we handle it specially. So set a
> // boolean flag that lets us quickly below know which we are dealing
> // with.
> const bool isNSAttr = (uriId == fXMLNSNamespaceId)
> || (uriId == fXMLNamespaceId)
> || XMLString::equals(suffPtr, XMLUni::fgXMLNSString)
> || XMLString::equals(getURIText(uriId), SchemaSymbols::fgURI_XSI);
> When isNSAttr is true, the attribute is not put in the fAttDefRegistry map, that is later used to check if a required attribute has been found in the XML.
> My patch would be to remove the test for (uriId == fXMLNamespaceId) from the expression, because I don't understand why the xml:xxx attributes should be treated in the same special way of xmlns:xxx and xsi:xxx (the latter are really special attributes, but xml:lang and xml:space are not). If xml:xxx must be treated specially because of PSVI, they should at least be put in the map.
> Alberto
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org