Re: [xml] validateing errors with libxml2



On Tue, Oct 23, 2001 at 10:20:43AM +0200, Morus Walter wrote:
Hi Micheal,

thanks for that quick answer.

I'am useing: libxml2-2.4.6

As an attachment I send you the DTD and the index.xml, 
which I could not parse. Hopefully this is readable now.


<!DOCTYPE NewsML PUBLIC "urn:newsml:iptc.org:20001006:NewsMLv1.0:1" 
"http://www.afp.com/dtd/NewsMLv1.0.dtd"; [
  <!ENTITY % nitf SYSTEM "http://www.afp.com/dtd/nitf-2-5.dtd";>
  %nitf;
]>
<NewsML>

I always thought it would be forbidden to include external parameter
entities in the internal subset. 
Seems I'm wrong. I can't find that in the spec.

  It wasn't clear at all from the previous revision. In Rev2 it's cleared,
it seems this is legal because the PE ref is placed at a level of a declaration
in the internal subset, what is forbidden is to use it in a declaration
(the rule being to simplify parsing of the internal subset).

The problem here seems to come from the rule, that parameter entities
in the internal subset may not apear within markup declarations.

  yes, but in this specific case it is not within markup declarations
but "between" markup declarations. So I think my code is wrong and need
to be fixed :-)

From the spec:
Well-Formedness Constraint: PEs in Internal Subset
In the internal DTD subset, parameter-entity references can occur only 
where markup declarations can occur, not within markup declarations. 
(This does not apply to references that occur in external parameter 
entities or to the external subset.)

libxml seems to treat the included external paramter entity as part
of the internal subset. I cannot tell, if that's correct, but it look's
logical at least.

  Well it is broken because the PE ref occurs precisely "where markup
declarations can occur".

So I suggest you create some 'newsml-nitf.dtd' which includes the
two dtd sets (NewsML and NITF) as external entities and reference this 
dtd as the external subset of the dtd in your document.

  That would seems cleaner, except that it would not allow some
tweaks based on the internal subset having higher priority than the
external subset. If they override stuff it's probably the best way
to achieve it.

  I should come with a patch soon,

Daniel

-- 
Daniel Veillard      | Red Hat Network http://redhat.com/products/network/
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]