Hi, I'm writing a new appletrailers plugin for freevo2 which uses kaa.xmlutils to write back a fxd file containing all the trailers from apple's xml trailers feed. At the moment kaa.xmlutils only supports one text element inside an element. This means that for example trying to write an element with mplayer-options in it will result in the closing tag including the extra options:
<url mplayer-options="-user-agent QuickTime7.6.2">http://trailers.apple.com/movies/universal/adjustmentbureau/adjustmentbureau-tlr1_a720p.m4v</url mplayer-options="-user-agent QuickTime7.6.2"> This patch addresses this and allows elements to contain more than one text element so that tags such as in this example are handled correctly: <url mplayer-options="-user-agent QuickTime7.6.2">http://trailers.apple.com/movies/universal/adjustmentbureau/adjustmentbureau-tlr1_a720p.m4v</url> John Index: base/src/xmlutils.py =================================================================== --- base/src/xmlutils.py (revision 4315) +++ base/src/xmlutils.py (working copy) @@ -28,9 +28,8 @@ """ This module provides a simple SAX handler with an interface similar to a pull parser and Wrapper around xml.mindom for easier parsing of simple configuration -files or fxd files for Freevo. The wrapper can not handle complex XML structures -and supports only one text element inside an element. The API is wrapped -to match the kaa coding style. +files or fxd files for Freevo. The wrapper can not handle complex XML structures. +The API is wrapped to match the kaa coding style. The logic and some functions are copied from xml.dom.minidom. """ @@ -164,7 +163,10 @@ # only a text node writer.write(">") _write_data(writer, self.minidom.childNodes[0].data) - writer.write("</%s>%s" % (self.minidom.tagName,newl)) + if self.minidom.tagName.find(" ") != -1: + writer.write("</%s>%s" % ((self.minidom.tagName[0:(self.minidom.tagName.find(" "))]), newl)) + else: + writer.write("</%s>%s" % (self.minidom.tagName,newl)) elif self.minidom.childNodes: # node with children writer.write(">%s"%(newl)) ------------------------------------------------------------------------------ This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev _______________________________________________ Freevo-devel mailing list Freevo-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freevo-devel