Re: [xml] XHTML Doc serialization and meta element



On Wed, Aug 24, 2005 at 07:50:37AM -0400, Rob Richards wrote:
I ran into a situation on a double free on a node and tracked down the 
issue to serializing an XHTML document.
xmlDocContentDumpOutput calls htmlSetMetaEncoding for XHTML documents 
which ends up altering the internal document by freeing the meta element 
and adding its own. Same thing happens with xmlNodeDumpOutput and 
htmlSaveFileFormat as well. Though htmlDocDump and htmlSaveFile don't 
mess with the meta element.

Problem with this is if a meta element already exists, I don't see why 
it should be altering the origional doc at all (which is something I do 
not want to happen). Also, it ends up forcing the content to be 
text/html when the origional document had set it to 
application/xhtml+xml. Now according to the specs 
(http://www.w3.org/TR/xhtml-media-types/), when using this media type, 
the http-equiv should not be included (W3C definition of should not) , 
so origional document is wrong in that respect, but this then means the 
meta tag should not automatically be added by the library either when 
the document is to be served as that media type.

It basically comes down to it would be one thing if the serialized 
version of the tree were altered - would have to think about wether it 
really was an issue or not - but I don't think an internal document 
should be altered during a serialization.

Thoughts?

  Just trying to follow the best practices outlined by XHTML1 W3C spec
    http://www.w3.org/TR/xhtml1/#C_9
Modifying the document is not ideal I agree, but it's simpler than trying to
get all user application fixed !

  "Problem with this is if a meta element already exists"
Which meta ? there is a zillion of those possible. Things are always clearer
with a complete example.

Daniel

-- 
Daniel Veillard      | Red Hat Desktop team 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]