* trying to solve the damn thing, use XML namespace for attribute
access * we got an attribute related error, no wonder...
This commit is contained in:
+2
-2
@@ -101,7 +101,7 @@ class LocalText(dict):
|
||||
assert self.tag != ''
|
||||
for key in self.iterkeys():
|
||||
newnode = newNode(node, self.tag)
|
||||
newnode.setAttributeNS(None, 'xml:lang', key)
|
||||
newnode.setAttributeNS(XML_NS, 'xml:lang', key)
|
||||
newtext = newTextNode(node, self[key])
|
||||
newnode.appendChild(newtext)
|
||||
node.appendChild(newnode)
|
||||
@@ -423,7 +423,7 @@ class autoxml(oo.autosuper, oo.autoprop):
|
||||
return getNodeAttribute(node, attr)
|
||||
def writetext(node, attr, text):
|
||||
#print 'write attr', attr, text
|
||||
node.setAttributeNS(None, attr, text)
|
||||
node.setAttributeNS(XML_NS, attr, text)
|
||||
anonfuns = cls.gen_anon_basic(attr, spec, readtext, writetext)
|
||||
return cls.gen_named_comp(attr, spec, anonfuns)
|
||||
|
||||
|
||||
@@ -35,6 +35,10 @@ import Ft
|
||||
from Ft.Xml.Domlette import implementation
|
||||
from Ft.Xml import ParsePath
|
||||
from Ft.Xml.Domlette import NonvalidatingReader
|
||||
from xml.dom import XHTML_NAMESPACE, XML_NAMESPACE
|
||||
|
||||
XHTML_NS = unicode(XHTML_NAMESPACE)
|
||||
XML_NS = unicode(XML_NAMESPACE)
|
||||
|
||||
import pisi
|
||||
|
||||
@@ -67,10 +71,10 @@ def newTextNode(node, text):
|
||||
|
||||
def getNodeAttribute(node, attrname):
|
||||
"""get named attribute from DOM node"""
|
||||
if not node.hasAttributeNS(None, attrname):
|
||||
if not node.hasAttributeNS(XML_NS, attrname):
|
||||
return None
|
||||
else:
|
||||
return node.getAttributeNS(None, attrname)
|
||||
return node.getAttributeNS(XML_NS, attrname)
|
||||
|
||||
def getChildElts(node):
|
||||
"""get only child elements"""
|
||||
|
||||
@@ -36,6 +36,10 @@ from Ft.Xml.Domlette import implementation
|
||||
from Ft.Xml.Domlette import NonvalidatingReader
|
||||
from Ft.Xml import Parse, ParsePath
|
||||
from Ft.Xml.Domlette import Print, PrettyPrint
|
||||
from xml.dom import XHTML_NAMESPACE, XML_NAMESPACE
|
||||
|
||||
XHTML_NS = unicode(XHTML_NAMESPACE)
|
||||
XML_NS = unicode(XML_NAMESPACE)
|
||||
|
||||
import pisi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user