def getNodeText(self, languageNode, xml_space="preserve"): """Retrieves the term from the given languageNode""" if languageNode is None: return None if self.textNode: terms = languageNode.iterdescendants(self.namespaced(self.textNode)) if terms is None: return None else: return getText(terms.next(), xml_space) else: return getText(languageNode, xml_space)
def getNodeText(self, languageNode, xml_space="preserve"): """Retrieves the term from the given :attr:`languageNode`.""" if languageNode is None: return None if self.textNode: terms = languageNode.iterdescendants(self.namespaced(self.textNode)) if terms is None: return None node = next(terms, None) if node is not None: return getText(node, xml_space) # didn't have the structure we expected return None else: return getText(languageNode, xml_space)
def getNodeText(self, languageNode, xml_space="preserve"): """Retrieves the term from the given languageNode""" if languageNode is None: return None if self.textNode: terms = languageNode.iterdescendants(self.namespaced(self.textNode)) if terms is None: return None try: return getText(terms.next(), xml_space) except StopIteration: # didn't have the structure we expected return None else: return getText(languageNode, xml_space)
def getcontexttuples(self, node, namespace): """ Returns all the information in the context nodes as a list of tuples of (type, text) """ contexts = node.findall(".//{%s}context" % namespace) return [(context.get("context-type"), getText(context)) for context in contexts]
def getcontexttuples(self, node, namespace): """Returns all the information in the context nodes as a list of tuples of (type, text)""" contexts = node.findall(".//{%s}context" % namespace) return [(context.get("context-type"), getText(context)) for context in contexts]
def node_text(self): """Returns the text content of the XML element.""" if self.xmlelement is None: return None return getText(self.xmlelement)