Hi Every One
The file test.php below trying to parss the test.xml by building a DOM tree and using xpath for the result to match a giving expression
the code OK no problem with it except that the trim function dose not delete the whitespace in the xml file
and that is my main problem
how can i solve it
and thanks in advance
saeed99
test.xml
<?xml version="1.0" encoding="UTF-8"?>
<test>
<question id="2" >
<answer id="25" >
<result>Wrong</result>
<mark>0</mark>
<symbol>an18</symbol>
</answer>
</question>
</test>
test.php
<?php
$dom= new DOMDocument;
$dom->Load('test.xml');
$xpath = new DOMXPath($dom);
$query = "//answer[@id='25' ]";
$rows= $xpath->query($query);
foreach ($rows as $row) {
$result=trim($row->childNodes->item(0)->nodeValue);
}
print $result;
?>