Edit report at http://bugs.php.net/bug.php?id=53988&edit=1

 ID:                 53988
 Updated by:         [email protected]
 Reported by:        joschmidt at users dot sourceforge dot net
 Summary:            xml_parse() reads illegal start character in
                     id-attribute
-Status:             Open
+Status:             Bogus
 Type:               Bug
 Package:            *XML functions
 Operating System:   Linux Ubuntu 10.10
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N

 New Comment:

You should use the DOM extension, namely the DOMDocument::validate()
method to validate an xml document against a DTD, as the xml_* function
does not validate against a DTD, only parses the document.


Previous Comments:
------------------------------------------------------------------------
[2011-02-10 22:36:49] joschmidt at users dot sourceforge dot net

Description:
------------
PHP version: PHP 5.3.3-1ubuntu9.3 with Suhosin-Patch (cli) (built: Jan
12 2011 16:08:14)

libXML Compiled Version: 2.7.7

libXML Loaded Version: 20707



The following invalid XTM 2.0 document (invalid id attribute) is parsed
successfully using xml_parse():



<topicMap xmlns="http://www.topicmaps.org/xtm/"; version="2.0">

  <topic id="2topic">

  </topic>

</topicMap>



ID is a derived datatype from XML NCName (see
http://www.w3.org/TR/xmlschema-2/#NCName). NCNames must not start with
[0-9]. NameStartChar is defined as:



NameStartChar ::= ":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6]
| [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] |
[#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] |
[#xFDF0-#xFFFD] | [#x10000-#xEFFFF] 



(see http://www.w3.org/TR/xml11/#sec-common-syn)



Test script:
---------------
xml_parse() is wrapped in
http://quaaxtm.svn.sourceforge.net/viewvc/quaaxtm/trunk/lib/quaaxtmio/src/in/XTM201TopicMapReader.class.php?revision=400

Expected result:
----------------
Parsing of <topic id="2topic"> should throw an appropriate XML error,
e.g. XML_ERROR_SYNTAX



------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=53988&edit=1

Reply via email to