On Wed, Aug 24, 2005 at 08:50:08AM -0400, Rob Richards wrote: > The following document is manually built via the API (this is why the > double free as the meta element is created and not being freed until > after the doc was serailized - but was already freed from the > serialization) then xmlDocDumpFormatMemory is called:
You keep an handle to the meta element while it was already inserted in the tree ? > Origional doc that was built: > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> > <html xmlns="http://www.w3.org/1999/xhtml"> > <head> > <meta http-equiv="Content-Type" content="application/xhtml+xml; > charset=UTF-8" /> > <title></title> > </head> > </html> > > Results of output - excluding the crash part :): > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> > <html xmlns="http://www.w3.org/1999/xhtml"> > <head> > <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> > <title></title> > </head> > </html> > > htmlSetMetaEncoding creates a new meta element and kills the old one. [...] > I wouldnt mind having to check if doc is xhtml and then calling > htmlGetMetaEncoding. If no encoding the app could then handle the issue > ints it own fashion and then set the format flag appropriately for the > output function. > > Just an idea unless someone has any other ways this might be handled. 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 ? Daniel -- Daniel Veillard | Red Hat Desktop team http://redhat.com/ [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
