Re: DTD loading

Christopher Gutteridge <[email protected]> Fri, 30 Aug 2002 14:33:12 +0100
Newsgroups gmane.comp.gnome.gdome
Message-ID <[email protected]>
What I'm actually using it for is internationalisation - All my strings
come from an XML config file, lightly sprinkled with XHTML markup.

So I have a hash table of references to XML fragments like

<p>Some problem occured (code #<ep:pin ref="code" />).</p><p>Please try again</p>

Which I then clone on demand and then replace the pin with, in this
case, the relevant number.

I guess I can redesign my code to keep the wrapping tag and copy the children
from it into the main thing. Ah well. 

I'm not out of the woods yet, but really appreciate this help.

On Fri, Aug 30, 2002 at 07:48:11AM -0400, Daniel Veillard wrote:
> On Fri, Aug 30, 2002 at 01:39:19PM +0200, Luca Padovani wrote:
> > On Fri, 2002-08-30 at 12:50, Christopher Gutteridge wrote:
> > > OK. I've written my first C/DOM program and I still get the problem. It's
> > > allegedly an Exception 0 (zero) which was not very helpful.
> > > 
> > > I attach the program. Hopefully it's not something weird and local to my
> > > machine or other horrors.
> > 
> > well, I found the reason. libxml2 does not clone document fragment
> > nodes, it just returns NULL. I had a quick look at the DOM
> > specification, it says that cloning a Document is implementation
> > dependent, but it says nothing about DocumentFragment, so I assume it is
> > legal to clone it. Maybe Daniel can give us some more details. I would
> > imagine it is quite easy to clone a DocumentFragment as well, I don't
> > think it poses any new problems.
> 
>   Hum, there isn't really a concept of "document fragment" in libxml2
> at least no such node is ever generated. A Document should be cloneable
> xmlCopyDoc() does this at the API level. A subtree of a document is cloneable
> using xmlDocCopyNode() with the recursive flag.
> 
> Daniel
> 
> -- 
> Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
> [email protected]  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
> http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
> _______________________________________________
> gdome mailing list
> [email protected]
> http://mail.gnome.org/mailman/listinfo/gdome

-- 
    Christopher Gutteridge -- [email protected] -- +44 (0)23 8059 4833

               >O___,
 _______________(___)______________________________________________________
|                                   |                                      |
| Now Playing: "Three Imaginary     | "There is no such thing as           |
| Boys" from Boys Don't Cry - The   | offensive material only offended     |
| Cure                              | people" - anon.                      |
|___________________________________|______________________________________|