Re: [xml] xmllint and namespaces

On Fri, Oct 11, 2002 at 02:00:57PM +0200, Stefan Kost wrote:
Hi hi,

I am sure this has been aksed bevor but wasn't succesful in the mail-archive.
I've just tried to use

xmllint --noout --valid test.xml

on test.xml :

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE giml SYSTEM "/opt/gitk/share/gitk/giml.dtd">
<giml:giml xmlns:giml="";>

a fragment of the dtd :

<!ELEMENT giml (context+)>
<!ELEMENT context (#PCDATA)>

and get the following output:

test.xml:6: validity error: Element giml content doesn't follow the DTD
Expecting (context)+, got (giml:context )

this looks to me as libxml2 would like me to put the name space into the dtd, 
which I don't belive is the right thing to do.

  Well it is ... 
  Validation happens before namespace recognition.
You must use the QName in the DTD as seens in the instance:

<!DOCTYPE giml:giml SYSTEM "/opt/gitk/share/gitk/giml.dtd">
<giml:giml xmlns:giml="";>


<!ELEMENT giml:glim (glim:context+)>
<!ELEMENT giml:context (#PCDATA)>

and don't forgot to add xmlns:giml as part of 
<!ATTLIST giml:glim

Or use the default namespace 
   <giml xmlns="";>

and keep your DTD as-is

  And please make sure you use the latests versions of libxml2


Daniel Veillard      | Red Hat Network
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

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