Convert this tree to a DOM object.
Currently this is lame because I convert the tree to text, then to DOM.
In the future, jaxb will be able to convert directly.
@return The dom tree.
557714
public Node getDOM()
    {
        if (this.getConvertToNative() != null)
        {
            Node node = this.getConvertToNative().getDOM();
            if (node != null)
                return node;
        }
        String strXML = this.getXML();
        return Utility.convertXMLToDOM(strXML);
    }
183504
public String getXML()
    {
        SOAPMessage message = (SOAPMessage)this.getRawData();
        if (message != null)
            return SOAPMessageTransport.messageToString(message);
        return super.getXML();
    }
263415
public function toXML( DOMDocument $dom )
    {
        if ( !$this->XMLStorable )
        {
            return false;
        }

        $itemNode = $dom->createElement( 'item' );

        foreach ( $this->attributes as $attrName => $attrValue )
        {
            switch ( $attrName )
            {
                case 'id':
                    $itemNode->setAttribute( 'id', $attrValue );
                    break;

                case 'action':
                    $itemNode->setAttribute( 'action', $attrValue );
                    break;

                default:
                    $node = $dom->createElement( $attrName );
                    $nodeValue = $dom->createTextNode( $attrValue );
                    $node->appendChild( $nodeValue );
                    $itemNode->appendChild( $node );
                    break;
            }
        }

        return $itemNode;
    }
193085
def nodeToXML(nodeObject):
    

    xmlRoot = etree.Element(NODE + "node", nsmap=NODE_NSMAP)
    nameNode = etree.SubElement(xmlRoot, NODE + "name")
    nameNode.text = nodeObject.node_name
    urlNode = etree.SubElement(xmlRoot, NODE + "url")
    urlNode.text = nodeObject.node_url
    pathNode = etree.SubElement(xmlRoot, NODE + "path")
    pathNode.text = nodeObject.node_path
    capNode = etree.SubElement(xmlRoot, NODE + "capacity")
    capNode.text = str(nodeObject.node_capacity)
    sizeNode = etree.SubElement(xmlRoot, NODE + "size")
    sizeNode.text = str(nodeObject.node_size)
    if nodeObject.last_checked:
        checkedNode = etree.SubElement(xmlRoot, NODE + "lastChecked")
        checkedNode.text = nodeObject.last_checked.strftime(TIME_FORMAT_STRING)
    return xmlRoot
635284
function domTree()
    {
        $contentObjectAttributeData = $this->ContentObjectAttributeData;
        if ( isset( $contentObjectAttributeData['DataTypeCustom']['dom_tree'] ) )
        {
            return $contentObjectAttributeData['DataTypeCustom']['dom_tree'];
        }

        $dom = new DOMDocument( '1.0', 'utf-8' );
        $xmlString = $contentObjectAttributeData['data_text'];
        $success = $xmlString == '' ? false : $dom->loadXML( $xmlString );
        if ( !$success )
        {
            $this->generateXMLData();
            $xmlString = $this->ContentObjectAttributeData['data_text'];
            $success = $dom->loadXML( $xmlString );
        }

        $contentObjectAttributeData['DataTypeCustom']['dom_tree'] = $dom;

        return $dom;
    }
1274257
public static HtmlTree MAIN() {
        HtmlTree htmltree = new HtmlTree(HtmlTag.MAIN);
        htmltree.setRole(Role.MAIN);
        return htmltree;
    }
984986
public function getOuterXml()
	{
		if ( is_null( $this->domNode ) ) return "";
		return is_null( $this->domNode->parentNode )
			? $this->domNode->ownerDocument->saveXml( $this->domNode )
			: $this->domNode->ownerDocument->saveXml( $this->domNode->parentNode );
	}
568191
def dom2object(node):
    

    value = []
    textnode_encountered = None
    for n in node.childNodes:

        if n.nodeType == 3:
            # Child is a text element - omit the dom tag #text and
            # go straight to the text value.

            # Note - only the last text value will be recorded

            msg = 'Text element has child nodes - this shouldn\'t happen'
            verify(len(n.childNodes) == 0, msg)


            x = n.nodeValue.strip()
            if len(x) == 0:
                # Skip empty text children
                continue

            textnode_encountered = value = x
        else:
            # XML element


            if textnode_encountered is not None:
                msg = 'A text node was followed by a non-text tag. This is not allowed.\n'
                msg += 'Offending text node: "%s" ' %str(textnode_encountered)
                msg += 'was followed by node named: "<%s>"' %str(n.nodeName)
                raise Exception, msg


            value.append(dom2object(n))


    # Deal with empty elements
    if len(value) == 0: value = ''


    if node.nodeType == 9:
        # Root node (document)
        tag = None
    else:
        # Normal XML node
        tag = node.nodeName


    X = XML_element(tag=tag,
                    value=value)

    return X
849799
public static String domToString(Node dom, boolean withXmlDeclaration)
            throws Exception {
        Transformer t = XmlTransformUtility.getTransformer();
        t.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
        if (withXmlDeclaration) {
            t.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no");
        } else {
            t.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
        }
        t.setOutputProperty(OutputKeys.METHOD, "xml");

        /* Transformer */
        StringWriter sw = new StringWriter();
        t.transform(new DOMSource(dom), new StreamResult(sw));

        return sw.toString();
    }
1112759
public Node getNode() {
        if (node == null) {
            if (resource != null) {
                node = resource.adaptTo(Node.class);
            }
        }
        return node;
    }
384866
public function asDOM()
	{
		$xml = '<xsl:template xmlns:xsl="http://www.w3.org/1999/XSL/Transform">'
		     . $this->__toString()
		     . '</xsl:template>';

		$dom = new TemplateDocument($this);
		$dom->loadXML($xml);

		return $dom;
	}
515036
public XMLElementList getChildren() {
		if (children != null) {
			return children;
		}
		
		NodeList list = dom.getChildNodes();
		children = new XMLElementList();
		
		for (int i=0;i<list.getLength();i++) {
			if (list.item(i) instanceof Element) {
				children.add(new XMLElement((Element) list.item(i)));
			}
		}
		
		return children;
	}
901975
public static HtmlTree SECTION() {
        HtmlTree htmltree = new HtmlTree(HtmlTag.SECTION);
        htmltree.setRole(Role.REGION);
        return htmltree;
    }
314122
public function toXML( DOMDocument $dom )
    {
        $zoneNode = $dom->createElement( 'zone' );
        foreach ( $this->attributes as $attrName => $attrValue )
        {
            switch ( $attrName )
            {
                case 'id':
                    $zoneNode->setAttribute( 'id', 'id_' . $attrValue );
                    break;

                case 'action':
                    $zoneNode->setAttribute( 'action', $attrValue );
                    break;

                case 'blocks':
                    foreach ( $this->attributes['blocks'] as $block )
                    {
                        $blockNode = $block->toXML( $dom );
                        $zoneNode->appendChild( $blockNode );
                    }
                    break;

                default:
                    $node = $dom->createElement( $attrName );
                    $nodeValue = $dom->createTextNode( $attrValue );
                    $node->appendChild( $nodeValue );
                    $zoneNode->appendChild( $node );
                    break;
            }
        }

        return $zoneNode;
    }
936394
public Element createDOMNode(Element parent) {
        Element domNode = parent.getOwnerDocument().createElement(tagName);
        LayoutUtil.copyAttributes(attributes, domNode);
        parent.appendChild(domNode);
        return domNode;
    }
1253888
public Class<? extends ElementBase> getRootClass() {
        LayoutElement top = root == null ? null : root.getChild(LayoutElement.class);
        return top == null ? null : top.getDefinition().getClazz();
    }
545471
public static HtmlTree HEADER() {
        HtmlTree htmltree = new HtmlTree(HtmlTag.HEADER);
        htmltree.setRole(Role.BANNER);
        return htmltree;
    }