Re: [xml] Multi-calling entities (or whatever)

On Sun, Mar 05, 2006 at 09:37:15AM +0100, Danilo Åegan wrote:


In-Reply-To: <20060304175954 GK346 redhat com> (Daniel Veillard's message of
       "Sat, 4 Mar 2006 12:59:54 -0500")

  Don't hijack threads, or fix/change your mail agent, doing a reply to
a completely unrelated mail from the list do break the few structure 
that we get from mailing list, even if you manually change the title !
Some users[1] are complaining that xml2po doesn't give expected
results for:

  <!ENTITY testentity "something">

<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
""; [
<!ENTITY % MY-ENTITIES SYSTEM "my-entities.ent">
<title>Test &testentity;</title>

If I even process it with "xmllint test.xml" (or merge translation 
using xml2po, which is using libxml2), I get:

<?xml version="1.0"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" ""; 
<!ENTITY % MY-ENTITIES SYSTEM "my-entities.ent">
<!ENTITY testentity "something">
<title>Test &testentity;</title>

I.e. instead of %MY-ENTITIES; entire my-entities.ent is inlined.  I
understand that the resulting file has the same meaning as the
original, but is this actually expected behaviour?

  yes there is no way around that. libxml2 DTD parser don't store the
unstructured part of the internal subset, just the resulting structure.

It might cause problems for xml2po as well since translations might 
want to use a different "my-entities.ent" (of course, I'd need to fix
xml2po to support "--keep-entities" as well, which is probably why I
didn't notice this sooner).

  Relying on parameter entities substitutions for localization doesn't 
sounds a good idea to me, very fragile and relies on the most complex
part of the XML-1.0 specification. For example a parser operating in 
non-validating mode of XML-1.0 is allowed to drop any declaration occuring
in the internal subset after a parameter entity reference, and will do
so without warning, fragile, very fragile ...


Daniel Veillard      | Red Hat
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]