Re: [xml] DTD validation issue
- From: Daniel Veillard <veillard redhat com>
- To: massimo morara <m morara 3di it>
- Cc: libxml2 <xml gnome org>
- Subject: Re: [xml] DTD validation issue
- Date: Tue, 26 Feb 2008 09:35:25 -0500
On Tue, Feb 26, 2008 at 01:40:08PM +0100, massimo morara wrote:
On Tue, Feb 26, 2008 at 04:15:28AM -0500, Daniel Veillard wrote:
Not a bug. When you do things like Post validation, you give it a
preparsed DTD. in that case the DTD was parsed without the context
of the document, while the internal subset changes the behaviour.
[...]
Sorry Daniel,
a different example about validation and post validation.
[...]
--- begin "b.xml" ---
<?xml version="1.0"?>
<root ns:attr="1"/>
--- end "b.xml" ---
--- begin "a.dtd" ---
<!ELEMENT root EMPTY>
<!ATTLIST root
xmlns:ns CDATA #FIXED "http://foo-dtd.org"
ns:attr CDATA #IMPLIED>
--- end "a.dtd" ---
[...]
But when i verify the validity of "b.xml" explicitly against
"a.dtd" ("--dtdvalid a.dtd"), i obtain the following error:
--- begin output ---
<root ns:attr="1"/>
^
b.xml:2: element root: validity error : No declaration for attribute
attr of element root
Document b.xml does not validate against a.dtd
--- end output ---
I suppose this is a bug (i'm wrong?) so i have inserted bug
445790 in bugzilla.
You forgot to mention the full set of errors
paphio:~/XML -> ./xmllint --noout --dtdvalid a.dtd b.xml
b.xml:2: namespace error : Namespace prefix ns for attr on root is not defined
<root ns:attr="1"/>
^
b.xml:2: element root: validity error : No declaration for attribute attr of element root
Document b.xml does not validate against a.dtd
paphio:~/XML ->
when you first parsed the document, it uses a namespace, which is undeclared.
So the document is not okay w.r.t. namespaces. The problem is that the prefix
is dropped from the document:
paphio:~/XML -> ./xmllint b.xml
b.xml:2: namespace error : Namespace prefix ns for attr on root is not defined
<root ns:attr="1"/>
^
<?xml version="1.0"?>
<root attr="1"/>
paphio:~/XML ->
Which sounds like a bug but completely unrelated to what you're trying to
link to , it's not at all related to validation (nor postvalidation)
Daniel
--
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard | virtualization library http://libvirt.org/
veillard redhat com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]