beginning: importFromString()
Brought to you by:
bs_php,
nigelswinson
From: darcy w.c. <da...@10...> - 2003-12-07 19:55:21
|
hi, i'm just beginning to work with PhpXPath. i'm having trouble understanding how to work with a string rather than a file. i've seen the method importFromString(), but i think my problem is that i don't understand how to apply the actual queries to it once it is loaded. Could someone give me an example or help me to understand how to work with both the XPathEngine and the XPath classes together. Below is what i have tried: $xmlOptions = array(XML_OPTION_CASE_FOLDING => FALSE, XML_OPTION_SKIP_WHITE => TRUE); $xpath = new XPathEngine($xmlOptions); $xpath = $xpath->importFromString("<people><name id=\"2\">fred</name></people>"); // i know this is not right - so how to i use the XPath class methods, once i have // used XPathEngine? $result = $xpath->getAttributes('//name[@id=2]','initial'); print_r($result); ~darcy w. christ 1000camels |