def xmlIfExtGetFirstChild(self, filterTag=None): # replace base method (performance optimized) if filterTag == None: children = self.getchildren() if children != []: element = children[0] else: element = None else: clarkFilterTag = toClarkQName(filterTag) element = self.find(clarkFilterTag) return element
def xmlIfExtGetFirstChild (self, filterTag=None): # replace base method (performance optimized) if filterTag == None: children = self.getchildren() if children != []: element = children[0] else: element = None else: clarkFilterTag = toClarkQName(filterTag) element = self.find(clarkFilterTag) return element
def createXmlTree(self, namespace, xmlRootTagName, attributeDict={}, publicId=None, systemId=None): rootNode = ElementExtension(toClarkQName(xmlRootTagName), attributeDict) rootNode.xmlIfExtSetParentNode(None) treeWrapper = self.treeWrapperClass(self, ElementTreeExtension(rootNode), self.useCaching) rootNodeWrapper = self.elementWrapperClass( rootNode, treeWrapper, []) # TODO: namespace handling return treeWrapper
def xmlIfExtSetAttribute(self, tupleOrAttrName, attributeValue, curNs): self.attrib[toClarkQName(tupleOrAttrName)] = attributeValue
def xmlIfExtGetAttribute(self, tupleOrAttrName): clarkQName = toClarkQName(tupleOrAttrName) if self.attrib.has_key(clarkQName): return self.attrib[clarkQName] else: return None
def xmlIfExtGetIterator(self, filterTag=(None, None)): clarkFilterTag = toClarkQName(filterTag) return self.getiterator(clarkFilterTag)
def xmlIfExtGetElementsByTagName(self, filterTag=(None, None)): clarkFilterTag = toClarkQName(filterTag) descendants = [] for node in self.xmlIfExtGetChildren(): descendants.extend(node.getiterator(clarkFilterTag)) return descendants
def xmlIfExtGetChildren(self, filterTag=None): if filterTag == None: return self.getchildren() else: clarkFilterTag = toClarkQName(filterTag) return self.findall(clarkFilterTag)
def xmlIfExtGetChildren (self, filterTag=None): if filterTag == None: return self.getchildren() else: clarkFilterTag = toClarkQName(filterTag) return self.findall(clarkFilterTag)
def createXmlTree (self, namespace, xmlRootTagName, attributeDict={}, publicId=None, systemId=None): rootNode = ElementExtension(toClarkQName(xmlRootTagName), attributeDict) rootNode.xmlIfExtSetParentNode(None) treeWrapper = self.treeWrapperClass(self, ElementTreeExtension(rootNode), self.useCaching) rootNodeWrapper = self.elementWrapperClass (rootNode, treeWrapper, []) # TODO: namespace handling return treeWrapper
def xmlIfExtRemoveAttribute (self, tupleOrAttrName): clarkQName = toClarkQName(tupleOrAttrName) if self.attrib.has_key(clarkQName): del self.attrib[clarkQName]
def xmlIfExtSetAttribute (self, tupleOrAttrName, attributeValue, curNs): self.attrib[toClarkQName(tupleOrAttrName)] = attributeValue
def xmlIfExtGetAttribute (self, tupleOrAttrName): clarkQName = toClarkQName(tupleOrAttrName) if self.attrib.has_key(clarkQName): return self.attrib[clarkQName] else: return None
def xmlIfExtGetIterator (self, filterTag=(None,None)): clarkFilterTag = toClarkQName(filterTag) return self.getiterator (clarkFilterTag)
def xmlIfExtGetElementsByTagName (self, filterTag=(None,None)): clarkFilterTag = toClarkQName(filterTag) descendants = [] for node in self.xmlIfExtGetChildren(): descendants.extend(node.getiterator(clarkFilterTag)) return descendants
def xmlIfExtRemoveAttribute(self, tupleOrAttrName): clarkQName = toClarkQName(tupleOrAttrName) if self.attrib.has_key(clarkQName): del self.attrib[clarkQName]
def xmlIfExtCreateElement(self, nsName, attributeDict, curNs): clarkQName = toClarkQName(nsName) return ElementExtension(clarkQName, attributeDict)
def xmlIfExtCreateElement (self, nsName, attributeDict, curNs): clarkQName = toClarkQName(nsName) return ElementExtension (clarkQName, attributeDict)