:return: this node as XML text.

        Delegates to :meth:`write`
500315
def xml(self, indent=4, **kwargs):
        
        writer = StringIO()
        self.write(writer, indent=indent, **kwargs)
        return writer.getvalue()
424384
def write(data)
      log_node(data, :out)
      if data.respond_to?(:to_xml)
        data = data.to_xml(:indent => 0)
      end
      send_data(data)
    end
681284
def to_xml(self):
        '''
        
        '''
        if not len(self.lines):
            raise GroupError("A group must at least have one line.")

        doc = Document()
        root = doc.createElement("group")
        super(Group, self).to_xml(root)
        self._create_text_node(root, "name", self.name, True)
        self._create_text_node(root, "description", self.description, True)

        lines = doc.createElement("lines")
        root.appendChild(lines)
        for line in self.__lines:
            if not issubclass(line.__class__, Line):
                raise GroupError('line of type %s is not an instance ' \
                                     'or a subclass of %s' %
                                     (line.__class__.__name__, Line.__name__))
            lines.appendChild(line.to_xml())

        return root
518841
def __get_xml_text(root):
    
    txt = ""
    for e in root.childNodes:
        if (e.nodeType == e.TEXT_NODE):
            txt += e.data
    return txt
454661
def writeXML(self, e):
        
        self.writeType(TYPE_XML)

        data = xml.tostring(e)

        if isinstance(data, unicode):
            data = data.encode('utf-8')

        self.stream.write_ulong(len(data))
        self.stream.write(data)
335338
def to_dict(self, xml):
        
        children = list(xml)
        if not children:
            return xml.text
        else:
            out = {}
            for node in list(xml):
                if node.tag in out:
                    if not isinstance(out[node.tag], list):
                        out[node.tag] = [out[node.tag]]
                    out[node.tag].append(self.to_dict(node))
                else:
                    out[node.tag] = self.to_dict(node)
            return out
830965
def write_xml_document(self, document):
        
        self._out.write(ET.tostring(document))
        self._out.flush()
1079218
def create_xml_string(self):
        
        root = self.create_xml()

        xml = '<?xml version="1.0" encoding="UTF-8"?>\n' + tostring(
            root, pretty_print=True
        )
        return xml
699039
def xml(self):
        

        self.pendingvalidation()

        E = ElementMaker(namespace="http://ilk.uvt.nl/folia",nsmap={'xml' : "http://www.w3.org/XML/1998/namespace", 'xlink':"http://www.w3.org/1999/xlink"})
        attribs = {}
        attribs['{http://www.w3.org/XML/1998/namespace}id'] = self.id

        #if self.version:
        #    attribs['version'] = self.version
        #else:
        attribs['version'] = FOLIAVERSION

        attribs['generator'] = 'pynlpl.formats.folia-v' + LIBVERSION

        metadataattribs = {}
        metadataattribs['{' + NSFOLIA + '}type'] = self.metadatatype

        if isinstance(self.metadata, ExternalMetaData):
            metadataattribs['{' + NSFOLIA + '}src'] = self.metadata.url

        e = E.FoLiA(
            E.metadata(
                E.annotations(
                    *self.xmldeclarations()
                ),
                *self.xmlmetadata(),
                **metadataattribs
            )
            , **attribs)
        for text in self.data:
            e.append(text.xml())
        return e
567052
def xml(self):
        
        rels_elm = CT_Relationships.new()
        for rel in self.values():
            rels_elm.add_rel(
                rel.rId, rel.reltype, rel.target_ref, rel.is_external
            )
        return rels_elm.xml
964805
def xml(self):
        
        tree = ElementTree.parse(METADATA_XML_TEMPLATE)
        root = tree.getroot()

        for name, prop in list(self.properties.items()):
            path = prop.xml_path
            elem = root.find(path, XML_NS)
            if elem is None:
                # create elem
                elem = insert_xml_element(root, path)
            elem.text = self.get_xml_value(name)

        return root
250255
def writeString(self, str):
        
        ret = libxml2mod.xmlOutputBufferWriteString(self._o, str)
        return ret
962082
def xml(self, attribs = None,elements = None, skipchildren = False):
        """"""
        E = ElementMaker(namespace=NSFOLIA,nsmap={None: NSFOLIA, 'xml' : "http://www.w3.org/XML/1998/namespace"})

        if not attribs: attribs = {}
        if not elements: elements = []

        if self.id:
            attribs['id'] = self.id
            try:
                w = self.doc[self.id]
                attribs['t'] = w.text()
            except KeyError:
                pass

        e  = makeelement(E, '{' + NSFOLIA + '}' + self.XMLTAG, **attribs)
        return e
11616
def struct_to_xml(node, struct):
    
    for obj in struct:
        for k, v in obj.items():
            etree.SubElement(node, k).text = v
244058
def get_xml(self):
        
        with io.StringIO() as string:
            string.write(ET.tostring(self.root, encoding="unicode"))
            return string.getvalue()
372615
def toXml(self, xparent=None):
        
        if xparent is None:
            xml = ElementTree.Element('object')
        else:
            xml = ElementTree.SubElement(xparent, 'object')

        xml.set('class', self.__class__.__name__)
        for name, value in self._xmlData.items():
            xprop = ElementTree.SubElement(xml, 'property')
            xprop.set('name', name)
            XmlDataIO.toXml(value, xprop)
        return xml
566792
def _create_xml_node(cls):
        
        try:
            xml_map = cls._xml_map
        except AttributeError:
            raise ValueError("This model has no XML definition")

        return _create_xml_node(
            xml_map.get('name', cls.__name__),
            xml_map.get("prefix", None),
            xml_map.get("ns", None)
        )