1

I need something like InnerHTML of a node, it is very simple, and perhaps I am not knowing how to use childNodes... I need some function that receives a node (DOMElement or DOMNode) with a root, and outputs the (DOM-XML object or XML-string value) filling. So, it is a "DOMnode node-root remover".

Example of workaround with PHP and regular expression:

 function xsl_getInner($ele) {
    // not works with $ele->childNodes
    $xml = $ele->ownerDocument->saveXML($ele);
    return preg_replace('/^<([a-zA-Z0-9_\-])\s?[^>]*>(.*?)</\1>$/s','$2',$xml);
 }

Related question: How to change root of a node with DomDocument methods?

Community
  • 1
  • 1
Peter Krauss
  • 13,174
  • 24
  • 167
  • 304
  • Which part(s) of [DOMDocument : how to get innerHTML()](http://stackoverflow.com/questions/7222453/domdocument-how-to-get-innerhtml) or [innerHTML in PHP's DomDocument?](http://stackoverflow.com/q/2087103/367456) did not work for you? – hakre May 01 '13 at 08:42

0 Answers0