[xml] validating ENTITY attributes (DTD/W3C Schema)



I'm trying to validate xml with ENTITY attributes against a w3c schema
using xmllint.  While researching my problem I found this behavior:

$ cat foo.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE r SYSTEM "foo.dtd" [
<!NOTATION jpeg PUBLIC "JPG" "JPG">
<!ENTITY foo SYSTEM "foo.jpg" NDATA jpeg>
]>
<r entity="foo"/>

$ cat foo.dtd
<!ELEMENT r EMPTY>
<!ATTLIST r entity ENTITY #REQUIRED>

$ xmllint --noout --valid foo.xml

$ xmllint --noout --dtdvalid foo.dtd foo.xml
foo.xml:0: validity error : ENTITY attribute entity reference an unknown entity "foo"
Document foo.xml does not validate against foo.dtd

Why does it validate with --valid, but not with with --dtdvalid?

Ok, back to validating against a schema:

$ cat foo.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";>
  <xs:element name="r">
    <xs:complexType>
      <xs:attribute name="entity" type="xs:ENTITY"/>
    </xs:complexType>
  </xs:element>
</xs:schema>

$ xmllint --noout --schema foo.xsd foo.xml
foo.xml:6: element r: Schemas validity error : Element 'r', attribute 'entity': 'foo' is not a valid value of 
the atomic type 'xs:ENTITY'.
foo.xml fails to validate

What have I done wrong?  Or should I file a bug?

Thanks,
Stephen



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]