Re: [xslt] scoped result tree fragments



>   Hum, libxslt doesn't fully use the dictionnaries yet. But you should
> be able to use it for xmlNewTextChild(), pass a NULL content, generate
> a disctionnary entry with xmlDictLookup() for your text, using the
> doc->dict, and the set the content of the text children of teh returned
> element to that dictionnary entry. Libxml2 should take care of the 
> (non-)freeing . Automatic dictionnary usage for text node content is
> not possible because at some point a too big dictionnary performs worse
> than no dictionnary, it's a trade off ...
> 

Thanks for the pointers, I'll experiment with that approach.  However I forsee
a potential problem.  The content passed into xmlNewTextChild() currently may
contain xml special characters such as '&'.  It will not contain any entity
refs.  If I use xmlDictLookup() I could have node->content on the text node
that has reserved xml characters.  I believe that is ok (the serialization
layer must handle that?), but can you confirm that a text node's content may
contain xml special characters not replaced with their entity refs?

Also I should see some benefit from using the dictionary for node->name.  Most
of the nodes are named the same thing so I need call the xmlDictLookup() only
once, and can just use the returned value for calls to xmlNodeEatName() to
create the element node.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]