Message: A new issue has been created in JIRA.
--------------------------------------------------------------------- View the issue: http://issues.apache.org/jira/browse/XERCESC-1240 Here is an overview of the issue: --------------------------------------------------------------------- Key: XERCESC-1240 Summary: xml:lang attribute is not validated Type: Bug Status: Unassigned Priority: Major Project: Xerces-C++ Components: Validating Parser (Schema) (Xerces 1.5 or up only) Versions: 2.5.0 Assignee: Reporter: Alberto Massari Created: Tue, 6 Jul 2004 8:37 AM Updated: Tue, 6 Jul 2004 8:37 AM Environment: Windows XP, Visual C++ 6 Description: 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 --------------------------------------------------------------------- JIRA INFORMATION: 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 If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]