Convert this tree to a XML string.
Override this.
@return The dom tree.
429429
public String getXML()
    {
        Object root = null;
        if (m_message != null)
            root = m_message.getRawData();
        if (root != null)
        {
            try {
                ByteArrayOutputStream out = new ByteArrayOutputStream();
                String strSOAPPackage = (String)((TrxMessageHeader)this.getMessage().getMessageHeader()).get(SOAPMessageTransport.SOAP_PACKAGE);
    
                Marshaller m = JaxbContexts.getJAXBContexts().getMarshaller(strSOAPPackage);
                if (m == null)
                    return null;
                synchronized(m)
                {   // Since the marshaller is shared (may want to tweek this for multi-cpu implementations)
                    m.marshal( root, out );
                }
                String strXML = out.toString(Constants.STRING_ENCODING);
                return strXML;
            } catch (IOException ex)  {
                ex.printStackTrace();   // Never
            } catch (JAXBException ex)   {
                ex.printStackTrace();
            } catch (java.lang.IllegalArgumentException ex)   {
                ex.printStackTrace();
            }
        }
        return null;
    }
1084692
public String dump() {

        try {
            Document doc = Node.dumpTree(m_root);
            OutputFormat outformat = OutputFormat.createPrettyPrint();
            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
            outformat.setEncoding("UTF-8");
            XMLWriter writer = new XMLWriter(buffer, outformat);
            writer.write(doc);
            writer.flush();
            return new String(buffer.toByteArray(), "UTF-8");
        } catch (IOException e) {
            // CAn't happen
            return null;
        }
    }
441225
public function toXml()
    {
        if ($this->blank())
            return;
        
        $t = get_class($this->current());
        
        $xml = '<?xml version="1.0" encoding="UTF-8"?>';
        $xml .= '<' . $t . '>';
        
        foreach ($this->members() as $obj) {
            $xml .= $obj->toXml(array('skip_instruct' => true));
        }
        
        $xml .= '</' . $t . '>';
        
        return $xml;
    }
216363
public String toXml() throws TwiMLException {
        try {
            Document doc = DocumentBuilderFactory
                .newInstance()
                .newDocumentBuilder()
                .newDocument();
            doc.setXmlStandalone(true);
            doc.appendChild(this.buildXmlElement(doc));

            Transformer transformer = TransformerFactory.newInstance().newTransformer();
            transformer.setOutputProperty(OutputKeys.INDENT, "no");
            DOMSource source = new DOMSource(doc);
            StreamResult output = new StreamResult(new StringWriter());
            transformer.transform(source, output);
            return output.getWriter().toString().trim();
        } catch (TransformerException te) {
            throw new TwiMLException("Exception serializing TwiML: " + te.getMessage());
        } catch (Exception e) {
            throw new TwiMLException("Unhandled exception: " + e.getMessage());
        }
    }
150421
public static String nodeToString(Node node)
    {
        StringWriter sw = new StringWriter();
        if (node instanceof Attr)
        {
            Attr attr = (Attr) node;
            return attr.getValue();
        }
        try
        {
            Transformer t = TransformerFactory.newInstance().newTransformer();
            t.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
            t.setOutputProperty(OutputKeys.INDENT, "no");
            t.transform(new DOMSource(node), new StreamResult(sw));
        }
        catch (TransformerException te)
        {
            LOG.warning("Transformer Exception: " + te.getMessage());
        }
        return sw.toString();
    }
1088805
public static Element stringToElement(String xml) throws Exception {
      ByteArrayInputStream bais = new ByteArrayInputStream(xml.getBytes("utf8"));
      DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
      DocumentBuilder builder = factory.newDocumentBuilder();
      Document d = builder.parse(bais);
      bais.close();
      return d.getDocumentElement();
   }
584258
public String toStringAST() {

        StringBuilder builder = new StringBuilder();

        walk(root, builder);

        return builder.toString();
    }
1065114
public function ToString()
	{
		if ( is_null( $this->domNode ) ) return "";
		if ( $this->domNode instanceof \DOMDocument )
		{
			$result = $this->domNode->saveXML( null );
			// Remove any initial PI
			$result = preg_replace( "/^<\?xml.*\?>\s/", "", $result );
			return $result;
		}
		else
		{
			// InnerXml?
			// return array_reduce(
			// 	iterator_to_array( $this->domNode->childNodes ),
			// 	function ( $carry, /** @var \DOMNode */ $child )
			// 	{
			// 		return $carry.$child->ownerDocument->saveXML( $child );
			// 	}
			// );
			$result = $this->domNode->ownerDocument->SaveXML( $this->domNode );
			return $result;
		}
	}
691058
def xml_to_root(xml: Union[str, IO]) -> ElementTree.Element:
    
    if isinstance(xml, str):
        if '<' in xml:
            return ElementTree.fromstring(xml)
        else:
            with open(xml) as fh:
                xml_to_root(fh)
    tree = ElementTree.parse(xml)
    return tree.getroot()
800700
def _tree_to_string(cls, root_element, xml_declaration=True, pretty_print=True):
        
        from lxml import etree
        return gf.safe_unicode(etree.tostring(
            root_element,
            encoding="UTF-8",
            method="xml",
            xml_declaration=xml_declaration,
            pretty_print=pretty_print
        ))
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
244058
def get_xml(self):
        
        with io.StringIO() as string:
            string.write(ET.tostring(self.root, encoding="unicode"))
            return string.getvalue()
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
657657
public static String convertXmlDocumentToString(DomDocument document) {
    StringWriter stringWriter = new StringWriter();
    StreamResult result = new StreamResult(stringWriter);
    transformDocumentToXml(document, result);
    return stringWriter.toString();
  }
313343
def to_xml_string(self):
        

        self.update_xml_element()
        xml = self.xml_element

        return etree.tostring(xml, pretty_print=True).decode('utf-8')
95747
public String getXML()
    {
        Object root = null;
        if (m_message != null)
            root = m_message.getRawData();
        if (root != null)
        {
            try {
                ByteArrayOutputStream out = new ByteArrayOutputStream();
                String packageName = (String)((TrxMessageHeader)this.getMessage().getMessageHeader()).get(SOAPMessageTransport.JIBX_PACKAGE_NAME);
                String bindingName = (String)((TrxMessageHeader)this.getMessage().getMessageHeader()).get(SOAPMessageTransport.JIBX_BINDING_NAME);
                if (packageName == null)
                {
                	packageName = root.getClass().getName();
                	packageName = packageName.substring(0, packageName.lastIndexOf('.'));
                	((TrxMessageHeader)this.getMessage().getMessageHeader()).put(SOAPMessageTransport.JIBX_PACKAGE_NAME, packageName);
                }
    
                IMarshallingContext m = JibxContexts.getJIBXContexts().getMarshaller(packageName, bindingName);
                if (m == null)
                    return null;
                synchronized(m)
                {   // Since the marshaller is shared (may want to tweek this for multi-cpu implementations)
                	m.marshalDocument(root, DBConstants.URL_ENCODING, null, out);
                }
                String strXML = out.toString(Constants.STRING_ENCODING);
                return strXML;
            } catch (IOException ex)  {
                ex.printStackTrace();   // Never
            } catch (JiBXException ex)   {
                ex.printStackTrace();
            } catch (java.lang.IllegalArgumentException ex)   {
                ex.printStackTrace();
            }
        }
        return null;
    }
1131127
private Document getDocument() {
        logger.entering();
        DOMDocumentFactory domFactory = new DOMDocumentFactory();
        SAXReader reader = new SAXReader(domFactory);
        Document doc;

        try {
            doc = reader.read(resource.getInputStream());
        } catch (DocumentException excp) {
            logger.exiting(excp.getMessage());
            throw new DataProviderException("Error reading XML data.", excp);
        }

        logger.exiting(doc.asXML());
        return doc;
    }