Re: [xml] XHTML Doc serialization and meta element



On Wed, Aug 24, 2005 at 07:15:01PM -0400, Rob Richards <rrichards ctindustries net> wrote:
Daniel Veillard wrote:

Another way would be to make libxml2 not touch anything if it detects
any http-equiv meta tag, and if it doesn't detect one try to put the
tag serialization in the output buffer, but not in the tree itself.
This would requires some tweaking of the serialization code but should
not be too hard. This would be more satisfactory from an API POV since
serialization would not modify the input tree, and would not disturb
headers if the application is already taking care of it, while still
adding the meta if the application is ignorant about it.
What do you think ?


Not sure which way this is going to be handled, but I took a crack at 
doing it when serializing.
Attached is the diff of the changes I made (only meant to look at not 
meant to be commited).
It looks a bit hackish, but couldnt see any other way to do it.
Didn't touch the HTMLTree.c file at this point till its decided if this 
is to be done during serialization or one of the other possible ways.

Just my opinion, but i think it really should happen during
serialization.

Another thing doing it this way is previously, meta element is only 
added if dumping the document element (html).
Now, if the head element were dumped as the top node in 
xmlNodeDumpOutput, the meta element is still going to be added to the 
output as there is no way to know then first node being dumped since all 
that is avaiable is the node and the xmlSaveCtxt (probably not a big 
deal though).

If you have the node, then you have its parent, and the parent of its
parent...

Mike



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