After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 136072 - anyURI datatype won't accept an empty value
anyURI datatype won't accept an empty value
Status: VERIFIED FIXED
Product: libxml2
Classification: Platform
Component: general
2.6.6
Other Linux
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2004-03-03 15:08 UTC by Anthony Carrico
Modified: 2009-08-15 18:40 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Anthony Carrico 2004-03-03 15:08:18 UTC
The XML Signature spec (http://www.w3.org/TR/xmldsig-core/) has an
example of an empty 'anyURI' attribute in a 'Reference' element:

 URI=""
    Identifies the node-set (minus any comment nodes) of the XML
    resource containing the signature

The "anyURI" datatype in libxml2 doesn't seem to support this kind of
empty value. Is it a bug in libxml2? Here is an example of the problem
using libml2 2.6.6 with the python bindings:

$ cat tmp.py
import libxml2

raw_schema = """<?xml version='1.0' encoding='UTF-8'?>
<element xmlns='http://relaxng.org/ns/structure/1.0'
         datatypeLibrary='http://www.w3.org/2001/XMLSchema-datatypes'
         name='URI'>
  <data type='anyURI'/>
</element>"""

raw_doc0 = """<?xml version='1.0' encoding='UTF-8'?>
<URI>http://bogus</URI>"""

raw_doc1 = """<?xml version='1.0' encoding='UTF-8'?>
<URI></URI>"""

def test():
  schema_xml = None
  doc0_xml = None
  doc1_xml = None
  try:
      schema_xml = libxml2.parseMemory(raw_schema, len(raw_schema))
      doc0_xml = libxml2.parseMemory(raw_doc0, len(raw_doc0))
      doc1_xml = libxml2.parseMemory(raw_doc1, len(raw_doc1))
      rngp = schema_xml.relaxNGNewDocParserCtxt()
      rngs = rngp.relaxNGParse()
      rctxt = rngs.relaxNGNewValidCtxt()
      print raw_doc0
      print
      print doc0_xml.relaxNGValidateDoc(rctxt)
      print
      print raw_doc1
      print
      print doc1_xml.relaxNGValidateDoc(rctxt)
      print
  finally:
      if doc0_xml: doc0_xml.freeDoc()
      if doc1_xml: doc1_xml.freeDoc()
      if schema_xml: schema_xml.freeDoc()

test()

$ python tmp.py
<?xml version='1.0' encoding='UTF-8'?>
<URI>http://bogus</URI>

0

<?xml version='1.0' encoding='UTF-8'?>
<URI></URI>

Type anyURI doesn't allow value ''
Error validating datatype anyURI
Element URI failed to validate content
1
Comment 1 Daniel Veillard 2004-03-14 12:29:13 UTC
That should be fixed by a patch just commited in CVS,

  thanks,

Daniel
Comment 2 Daniel Veillard 2004-03-25 11:26:28 UTC
This should be closed by release of libxml2-2.6.8,
                                                                                
  thanks,
                                                                                
Daniel