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" [
<!ENTITY foo SYSTEM "foo.jpg" NDATA jpeg>
<r entity="foo"/>

$ cat foo.dtd

$ 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="";>
  <xs:element name="r">
      <xs:attribute name="entity" type="xs:ENTITY"/>

$ 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.



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