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



 

-----Original Message-----
From: xml-bounces gnome org [mailto:xml-bounces gnome org] On 
Behalf Of Stephen J. Smith
Sent: Wednesday, May 17, 2006 7:42 PM
To: xml gnome org
Subject: [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?

At least with Saxon the scenario validates; although it even validates
if I remove the DOCTYPE from the instance, so Saxon might just let
through any values defined to be of type xs:ENTITY.

Filing a bug would be great.

Regards,

Kasimier



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