Heeft iemand wel eens gewerkt met php XPath?
http://sourceforge.net/projects/phpxpath
Het lijkt interessant op zich maar ik heb er wat problemen mee.
Neem dit XML document:
Als ik doe:
Dan zegt het eerste stuk netjes :
Ik heb nog wat
Maar de appendChild() functie geeft de error:
XPath error in XPath.php:1344 The supplied string does not uniquely describe a node in the xml document:
Snapt iemand waarom dit niet werkt?
Met precies dezelfde XPath expressie kan ik WEL data lezen maar geen child toevoegen...
http://sourceforge.net/projects/phpxpath
Het lijkt interessant op zich maar ik heb er wat problemen mee.
Neem dit XML document:
code:
1
2
3
4
5
| <?xml version="1.0"?> <channelconfiguration> <marco>waarde</marco> <anton>nog wat</anton> </channelconfiguration> |
Als ik doe:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
| <?
include_once("XPath.php");
$objTest = new XPath("testfile.xml");
$objTest->setCaseFolding($onOff = "FALSE");
$foo = $objTest->getData("/channelconfiguration/anton");
echo "Ik heb $foo";
$objTest->appendChild("/channelconfiguration/anton", "antonchild");
?> |
Dan zegt het eerste stuk netjes :
Ik heb nog wat
Maar de appendChild() functie geeft de error:
XPath error in XPath.php:1344 The supplied string does not uniquely describe a node in the xml document:
Snapt iemand waarom dit niet werkt?
Met precies dezelfde XPath expressie kan ik WEL data lezen maar geen child toevoegen...