qiuwei / jing-trang

Automatically exported from code.google.com/p/jing-trang
Other
1 stars 1 forks source link

conversion from XML and attributes with a default value #87

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hello,

Forwarding a bug from
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=288149

What steps will reproduce the problem?
$ cat >> test.xml
<?xml version="1.0"?>
<!DOCTYPE root [
<!ELEMENT root (#PCDATA)>
<!ATTLIST root
  type  (text|number)  "text"
  >
]>
<root>Test</root>
$ trang test.xml test.rng
$ xmllint --noout --relaxng test.rng test.xml

What is the expected output? What do you see instead?

test.xml:8: element root: Relax-NG validity error : Element root failed to 
validate attributes
test.xml fails to validate

What version of the product are you using? On what operating system?

20090818-1 from Debian

Samuel

Original issue reported on code.google.com by youpi...@gmail.com on 20 Sep 2009 at 11:47

GoogleCodeExporter commented 8 years ago
This is a bug in xmllint.

Trang converts test.xml to:

<?xml version="1.0" encoding="UTF-8"?>
<grammar ns="" xmlns="http://relaxng.org/ns/structure/1.0"
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
  <start>
    <element name="root">
      <attribute name="type">
        <data type="NCName"/>
      </attribute>
      <data type="NCName"/>
    </element>
  </start>
</grammar>

test.xml is valid with respect to this.

I guess --relaxng tells xmllint not to do any DTD processing, which is not 
correct:
it should at least do the minimum amount of processing required by the XML
Recommendation, which includes defaulting attributes specified in the internal 
subset.

Original comment by jjc.jclark.com on 21 Sep 2009 at 12:47