I'm trying to get an xpath xpression that will remove my outer tag, but it's removing that, plus the inner tag and printing the element data. How do I get it to print my prompt tags also? Hope someone knows...
My php looks like this:
<?php
#get file
$xml = simplexml_load_file('content.xml') or die ("Unable to load XML string!");
#loop through results
foreach ( $xml->xpath('//prompt') as $voiceQ) {
echo "<h2>Thank you for visiting our site2</h2>";
print $voiceQ;
} //for
?>
My content.xml looks like this
(I'm writing to this file and it's losing some formatting. I don't think this is the problem):
<?xml version="1.0" encoding="UTF-8"?>
<result>
<prompt>
Welcome to Group Finder, Mary Lamb . We see that
you like the group: JackJohnson
</prompt>
</result>
My output looks like this:
Welcome to Group Finder, Mary Lamb . We see that you like the group: JackJohnson
But I want it to look like this:
(just remove result tags):
<prompt>Welcome to Group Finder, Mary Lamb . We see that you like the group: JackJohnson</prompt>