Author: dmeyer
Date: Sun Feb 26 14:46:04 2006
New Revision: 1228

Modified:
   trunk/base/src/base/libxml2.py

Log:
make it possible to read from memory

Modified: trunk/base/src/base/libxml2.py
==============================================================================
--- trunk/base/src/base/libxml2.py      (original)
+++ trunk/base/src/base/libxml2.py      Sun Feb 26 14:46:04 2006
@@ -202,7 +202,7 @@
 
 
     def getattr(self, name):
-        return libxml2mod.xmlGetProp(self._o, name)
+        return unicode(libxml2mod.xmlGetProp(self._o, name), 'utf-8')
 
 
     def setattr(self, name, value):
@@ -293,7 +293,13 @@
 
         # a "normal" document without special root node
         self._doc = None
-        if filename:
+        if filename and filename.startswith('<?xml'):
+            # memory based
+            self._o = libxml2mod.xmlParseDoc(filename)
+            if self._o is None:
+                # Oops, something went wrong
+                raise ParserError('xmlParseFile() failed')
+        elif filename:
             # load file
             self._o = libxml2mod.xmlParseFile(filename)
             if self._o is None:


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to