Hey all,
Im attempting to parse the following xml schema:
so basically theres one <language> which contains lots of <text> elements, now so far I have this:
Which, when I call GetText('Hello'); for example, should return 'Hola', except im not sure how to retrieve the inner text for a DomNode ?
Also I havent tested that code yet, so if anyone sees anything wrong please tell me,
Thanks very much,
Matt.
Im attempting to parse the following xml schema:
Code:
<language name="Spanish" short="Es">
<text key="Hello">
Hola
</text>
<text key="House">
Casa
</text>
</language>
so basically theres one <language> which contains lots of <text> elements, now so far I have this:
Code:
function getText($key)
{
$doc = new DOMDocument();
$doc->load($this->_file);
$xpath = new DOMXPath($doc);
$nodelist = $xpath->query("language/text[@key='$key']");
$node = $nodelist->item(0);
// Return inner text from node.
}
Which, when I call GetText('Hello'); for example, should return 'Hola', except im not sure how to retrieve the inner text for a DomNode ?
Also I havent tested that code yet, so if anyone sees anything wrong please tell me,
Thanks very much,
Matt.