[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: [xml] Multi-calling entities (or whatever)
- From: Daniel Veillard <veillard redhat com>
- To: Danilo Šegan <danilo gnome org>
- Cc: xml gnome org
- Subject: Re: [xml] Multi-calling entities (or whatever)
- Date: Sun, 5 Mar 2006 05:28:08 -0500
On Sun, Mar 05, 2006 at 09:37:15AM +0100, Danilo Šegan wrote:
> Hi,
Hi
> 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:
>
> my-entities.ent:
> <!ENTITY testentity "something">
>
> test.xml:
> <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
> "http://www.docbook.org/xml/4.4/docbookx.dtd" [
> <!ENTITY % MY-ENTITIES SYSTEM "my-entities.ent">
> %MY-ENTITIES;
> ]>
> <article>
> <title>Test &testentity;</title>
> </article>
>
> 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" "http://www.docbook.org/xml/4.4/docbookx.dtd" [
> <!ENTITY % MY-ENTITIES SYSTEM "my-entities.ent">
> <!ENTITY testentity "something">
> ]>
> <article>
> <title>Test &testentity;</title>
> </article>
>
> 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
--
Daniel Veillard | Red Hat http://redhat.com/
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]