def namespaced(self, name): """Returns name in Clark notation. For example namespaced("source") in an XLIFF document might return:: {urn:oasis:names:tc:xliff:document:1.1}source This is needed throughout lxml. """ return namespaced(self.namespace, name)
def createfromxmlElement(cls, element, namespace=None, element_name="str", attribute_name="key"): """Attempts to create a unit from the passed element. element must not be None and must match the given element name (including namespace); otherwise None will be returned. """ if element is None: return None if element.tag != namespaced(namespace, element_name): return None unit = cls(source=None, namespace=namespace, element_name=element_name, attribute_name=attribute_name) unit.xmlelement = element return unit
def namespaced(self, name): """Returns name in Clark notation.""" return namespaced(self.namespace, name)