On Wed, Nov 01, 2006 at 10:36:44AM +0100, Keim, Markus wrote:
> >   "we dont' know what the data are but we expect to process 
> > them cleanly"
> > this sounds very similar to not knowing the encoding of a 
> > piece of text,
> 
> Similar, maybe. Tho my heuristics would've to answer a question
> with far less possibilties: Does an input buffer contain references
> to (pre-) defined entities or not?
> I still think it's possible, but it's not efficient (at least not
> by comparison to a developer using a proper call for an actual
> piece of input).

I don't think it's possible. If you see < in text, that could mean
the character < in an XML fragment, or &lt; from a text containing an
XML example.

> > In both case only one solution: educate the users/developpers.
> 
> Well, I'm sure that you're well aware that some (ideal) solutions
> are hard to realise...

  Sure, but I explain why a generic solution is simply not possible.
And in that case it's hard for me to really make a suggestion or
embbed such code in libxml2.

> >   it's perfectly clean to use diret access to the node structure. Just
> > check that the target strings are not from the doc 
> > dictionnary (in which case don't free them)
> 
> How do I check this (OK, I can look that up, but probably you know
> it OTTOYH)?

   check doc->dict and use xmlDictOwn on the pointer to the string.

> > and overwise use xmlMalloc/xmlFree to  manipulate the target
> > text nodes. Of course if you use non-predefined entities, 
> > then you will
> > have to add entities references to the element children list.
> 
> I'll take xmlNodeSetContent() as template to implement an
> "...addContent" with entity support
[...]
> 
> P.S.: Attached is a diff of tree.c (against the current CVS head)
>       which would add some documentation for the
>       xmlNode[Set|Add]Content functions.


  Okay, cool, applied ! I will commit soonish,

    thanks,

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
[EMAIL PROTECTED]  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
[email protected]
http://mail.gnome.org/mailman/listinfo/xml

Reply via email to