List Info

Thread: validating ENTITY attributes (DTD/W3C Schema)




validating ENTITY attributes (DTD/W3C Schema)
user name
2006-05-17 17:42:26
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 xmlnss=&q
uot;http://www.w3.org/20
01/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
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xmlgnome.org
http://mai
l.gnome.org/mailman/listinfo/xml
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )