private static function convertNode(XMLElement $element, DOMNode $node)
    {
        if ($node->hasAttributes()) {
            foreach ($node->attributes as $name => $attrEl) {
                $element->setAttribute($name, General::sanitize($attrEl->value));
            }
        }

        if ($node->hasChildNodes()) {
            foreach ($node->childNodes as $childNode) {
                if ($childNode instanceof DOMCdataSection) {
                    $element->setValue(General::wrapInCDATA($childNode->data));
                } elseif ($childNode instanceof DOMText) {
                    if ($childNode->isWhitespaceInElementContent() === false) {
                        $element->setValue(General::sanitize($childNode->data));
                    }
                } elseif ($childNode instanceof DOMElement) {
                    self::convert($element, $childNode);
                }
            }
        }
    }
private static function convertNode(XMLElement $element, DOMNode $node)
    {
        if ($node->hasAttributes()) {
            foreach ($node->attributes as $name => $attrEl) {
                $element->setAttribute($name, General::sanitize($attrEl->value));
            }
        }

        if ($node->hasChildNodes()) {
            foreach ($node->childNodes as $childNode) {
                if ($childNode instanceof DOMCdataSection) {
                    $element->setValue(General::wrapInCDATA($childNode->data));
                } elseif ($childNode instanceof DOMText) {
                    if ($childNode->isWhitespaceInElementContent() === false) {
                        $element->setValue(General::sanitize($childNode->data));
                    }
                } elseif ($childNode instanceof DOMElement) {
                    self::convert($element, $childNode);
                }
            }
        }
    }
private static function convertNode ( XMLElement $ element , DOMNode $ node ) { if ( $ node -> hasAttributes ( ) ) { foreach ( $ node -> attributes as $ name => $ attrEl ) { $ element -> setAttribute ( $ name , General :: sanitize ( $ attrEl -> value ) ) ; } } if ( $ node -> hasChildNodes ( ) ) { foreach ( $ node -> childNodes as $ childNode ) { if ( $ childNode instanceof DOMCdataSection ) { $ element -> setValue ( General :: wrapInCDATA ( $ childNode -> data ) ) ; } elseif ( $ childNode instanceof DOMText ) { if ( $ childNode -> isWhitespaceInElementContent ( ) === false ) { $ element -> setValue ( General :: sanitize ( $ childNode -> data ) ) ; } } elseif ( $ childNode instanceof DOMElement ) { self :: convert ( $ element , $ childNode ) ; } } } }
Given a DOMNode, this function will help replicate it as an
XMLElement object

@since Symphony 2.5.2
@param XMLElement $element
@param DOMNode $node
Given a DOMNode this function will help replicate it as an XMLElement object