Possible Duplicate:
PHP SimpleXML get innerXML
I've seen others questions related to simplexml and node value but couldn't find an answer to my problem.
I have a PHP var which contains an xml document formed like that :
<div id="container">
<div id="header"></div>
<div id="main">
##CONTENTS## cd <strong>dscsdcsd</strong> sdcsc
<div>my content here</div>
<span>and there</span>
</div>
<div id="footer"> </div>
</div>
I want to retrieve the node value. But with the following code, I also retrieve the tag :
$xml = simplexml_load_string($_POST['newsletter_body']);
$att = 'id';
foreach ($xml->children() as $el) {
if($el->attributes()->$att == 'main') {
$body_content = $el->asXml();
}
}
Could someone tell me how to get only node value (without using xpath)?
To be clear, now I get :
<div id="main">
##CONTENTS## cd <strong>dscsdcsd</strong> sdcsc
<div>my content here</div>
<span>and there</span>
</div>
And I just want :
##CONTENTS## cd <strong>dscsdcsd</strong> sdcsc
<div>my content here</div>
<span>and there</span>
Many thanks