[xml] LibXML-DTD-Validation + Namespaces



Hi,

I'm not sure whether this is a bug or I missed something, maybe this
also has been a bug and has been already fixed because my libxml is
fairly old(2.5.7).

Take a look at the following DTD's:

DTD-1:
---------------------8<---------------------
<!ELEMENT foo ( bar, beso:bar )>
<!ATTLIST foo
            xmlns:beso CDATA #REQUIRED


<!ELEMENT bar EMPTY>
<!ATTLIST bar
            beso:testbar CDATA #IMPLIED
            testbar      CDATA #IMPLIED>

<!ELEMENT beso:bar EMPTY>
---------------------8<---------------------

DTD-2:
---------------------8<---------------------
<!ELEMENT foo ( bar, beso:bar )>
<!ATTLIST foo
            xmlns:beso CDATA #REQUIRED


<!ELEMENT bar EMPTY>
<!ATTLIST bar
            beso:testbar CDATA #IMPLIED
            testbar      CDATA #REQUIRED>

<!ELEMENT beso:bar EMPTY>
---------------------8<---------------------

DTD-3:
---------------------8<---------------------
<!ELEMENT foo ( bar, beso:bar )>
<!ATTLIST foo
            xmlns:beso CDATA #REQUIRED


<!ELEMENT bar EMPTY>
<!ATTLIST bar
            beso:testbar CDATA #IMPLIED
            testbar      CDATA #REQUIRED>
---------------------8<---------------------


XML:
---------------------8<---------------------
<?xml version="1.0" ?>
<!DOCTYPE foo SYSTEM "./test.dtd" >
<foo xmlns:beso="http://www.bestsolution.at/testns";>
    <bar beso:testbar="bli" testbar="blo" />
    <beso:bar beso:testbar="bli" testbar="blo" />
</foo>
---------------------8<---------------------

Using xmllint(xmllint --valid --noout test.xml) I expected the following
results:

DTD1: invalid => no attribute (beso:testbar,testbar) in beso:bar
DTD2: invalid => no attribute (beso:testbar,testbar) in beso:bar
DTD3: invalid => no element beso:bar in foo

But got:

DTD1: valid (is there some inheritance???if yes, see DTD2)
DTD2: valid (if attributes are inherited why does #REQUIRED is 
             transformed to #IMPLIED)
DTD3: valid 

What am I missing, is libxml's DTD-Validation broken or does it follow
the XML-specs?

thx

Tom
-- 
   \\\||///
  \\  - -  //
   (  @ @  )
-oOo--( )--oOo----------------------------------------------------------
                     ___  ___                                tom schindl
      o       __    /  / /           innovative medientechnik planung AG
     / /\/\/ / /   /__/ / __            mailto:tom schindl profile co at
    / / / / /_/   /  / /___/                        http://www.impire.de
           /                 voice:+43(512)34193431,fax:+43(512)34193420
   Eduard-Bodem-Gasse 6, A-6020 Innsbruck, Austria, Software Engineering
------------------------------------------------------------------------




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