Re: [xml] xmllint: validating a document that doesn't specify a DTD



On Tue, Nov 17, 2009 at 01:33:44PM +0100, Murray Cumming wrote:
Should I be able to validate an XML document (such as a .glade file)
that has no DOCTYPE line, and therefore doesn't specify a DTD?

When I try it with xmllint, I get this error
  validity error : Validation failed: no DTD found !
even when I have specified a local DTD with --dtdvalid.

  Works for me with the version from git head:

paphio:~/XML -> cat 127772.dtd
<!ELEMENT a (b*)>
<!ELEMENT b (#PCDATA)>

paphio:~/XML -> cat 127772.xml
<?xml version="1.0"?>
<a>
  <b>b text</b>
</a>

paphio:~/XML -> xmllint  --dtdvalid 127772.dtd 127772.xml
<?xml version="1.0"?>
<a>
  <b>b text</b>
</a>
paphio:~/XML -> vi 127772.xml
paphio:~/XML -> xmllint  --dtdvalid 127772.dtd 127772.xml
<?xml version="1.0"?>
<a>
  <c>b text</c>
</a>
127772.xml:2: element a: validity error : Element a content does not
follow the DTD, expecting (b)*, got (c )
127772.xml:3: element c: validity error : No declaration for element c
Document 127772.xml does not validate against 127772.dtd
paphio:~/XML ->

  check your version ...

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/



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