I have an xml file with notes in the following format:
<notedate>16-12-2005</notedate>
<username>Test Name</username>
<notetype>OUTSTANDING MATTERS</notetype>
<notesummary></notesummary>
<notebody>TEST<BR/><BR/>TEST TEST TEST</notebody>
</note>
I am using the following functions:
function get_content($parent)
{
$nodes = $parent->children();
while($node = array_shift($nodes))
{
if ($node->type == XML_TEXT_NODE)
return $node->content;
return "";
}
}
# get the content of a particular node
function find_content($parent,$name)
{
$nodes = $parent->children();
while($node = array_shift($nodes))
{
if ($node->tagname == $name)
return get_content($node);
}
return "";
}
in the following way:
echo "<h2>Notes</h2>";
$notes = $case->get_elements_by_tagname("note");
while($note = array_shift($notes))
{
echo "<p>";
br_field("Date note made", find_content($note, "notedate"));
br_field("Note made by", find_content($note, "username"));
br_field("Note type", find_content($note, "notetype"));
br_field("Details", find_content($note, "notebody"));
echo "</p>";
}
All is reading from the xml fine unless there are <BR/> tags in the xml file in the <notebody> tag (which there often are). It doesnt seem to want to echo anything after these tags in the above example it would echo one TEST and then stop.
Any suggestions?? :bemused: