diff --git a/pisi/xml/autoxml.py b/pisi/xml/autoxml.py index 9f47f548..cc6d1c40 100644 --- a/pisi/xml/autoxml.py +++ b/pisi/xml/autoxml.py @@ -25,14 +25,14 @@ """ # System -import xml.dom.minidom as mdom -from xml.parsers.expat import ExpatError import locale import codecs import types import formatter import sys from StringIO import StringIO +#import xml.dom.minidom as mdom +#from xml.parsers.expat import ExpatError import gettext __trans = gettext.translation('pisi', fallback=True) @@ -105,7 +105,7 @@ class LocalText(dict): newtext = newTextNode(node, self[key]) newnode.appendChild(newtext) node.appendChild(newnode) - + def errors(self, where = unicode()): errs = [] langs = [ locale.getlocale()[0][0:2], 'tr', 'en' ] diff --git a/pisi/xml/xmlext.py b/pisi/xml/xmlext.py index 75381f63..3c209836 100644 --- a/pisi/xml/xmlext.py +++ b/pisi/xml/xmlext.py @@ -12,8 +12,8 @@ # Authors: Eray Ozkural try: - #from xmlextpiks import * - zimbabwe + #zimbabwe # comment out to disable piks + from xmlextpiks import * except: print 'xmlext: piksemel implementation cannot be loaded, falling back to minidom' from xmlextmdom import * diff --git a/pisi/xml/xmlextmdom.py b/pisi/xml/xmlextmdom.py index 4cab2b72..37d10cca 100644 --- a/pisi/xml/xmlextmdom.py +++ b/pisi/xml/xmlextmdom.py @@ -195,4 +195,4 @@ def addNode(node, tagpath, newnode = None, branch=True): def addText(node, tagPath, text, branch = True): newnode = newTextNode(node, text) - addNode(node, tagPath, newnode, branch) + return addNode(node, tagPath, newnode, branch = branch) diff --git a/pisi/xml/xmlextpiks.py b/pisi/xml/xmlextpiks.py index aa815998..ae5dd248 100644 --- a/pisi/xml/xmlextpiks.py +++ b/pisi/xml/xmlextpiks.py @@ -39,10 +39,10 @@ def getNodeAttribute(node, attrname): def getChildElts(node): """get only child elements""" - return [x for x in parent.childNodes if x.type == TAG ] + return [x for x in parent.childNodes if x.type() == TAG ] def getTagByName(parent, childName): - return [x for x in parent if x.type == TAG and x.name == childName] + return [x for x in parent if x.type() == TAG and x.name() == childName] def getNodeText(node, tagpath = ""): """get the first child and expect it to be text!""" @@ -110,7 +110,7 @@ def createTagPath(node, tags): if len(tags)==0: return node for tag in tags: - node = node.appendTag(Node(tag)) + node = node.appendTag(tag) return node def addTagPath(node, tags, newnode=None): @@ -163,6 +163,7 @@ def addNode(node, tagpath, newnode = None, branch=True): #def newTextNode(node, text): # return Node(text) + def addText(node, tagPath, text, branch = True): - newnode = newTextNode(node, text) - addNode(node, tagPath, newnode, branch) + node = addNode(node, tagPath, branch = branch) + return node.appendData(text) diff --git a/pisi/xml/xmlfile.py b/pisi/xml/xmlfile.py index 01a96d29..f544e5f2 100644 --- a/pisi/xml/xmlfile.py +++ b/pisi/xml/xmlfile.py @@ -12,9 +12,9 @@ # Authors: Eray Ozkural try: - #from xmlextpiks import * - #from xmlfilepiks import * - horagata + #horagata # comment out to disable piks + from xmlextpiks import * + from xmlfilepiks import * except: print 'xmlfile: piksemel implementation cannot be loaded, falling back to minidom' from xmlfilemdom import * diff --git a/tests/xmlexttests.py b/tests/xmlexttests.py index b30ca37e..d4c25430 100644 --- a/tests/xmlexttests.py +++ b/tests/xmlexttests.py @@ -34,7 +34,7 @@ class XmlExtTestCase(testcase.TestCase): self.assertEqual(xmlext.getNodeText(codeswith[2]), 'Caglar') def testAdd(self): - node = xmlext.newDocument('team') + node = xmlext.newDocument('pardus') #node = a.documentElement xmlext.addText(node, 'team/coder', 'zibidi1') xmlext.addText(node, 'team/coder', 'zibidi2')