I am trying to delete a node using XPATH and php, while coming two XPATH queries.
I am using php 5 for such problem. I tried to use DOMDocument with no luck.
enter code here
//The php file
$xml_str = file_get_contents("projectTest.xml");
$xml = new SimpleXMLElement($xml_str);
echo $xml->saveXML();
unset($xml->xpath("/project/Item/username[@date='2019-04-20'] and
/project/Item/username/clientID[text()=='10000']")[0]->{0});
echo $xml->saveXML();
//The XML File
<project>
<Item>
<username date="2019-04-20">
<clientID>10000</clientID>
</username>
<name>Test1</name>
<price>200</price>
<quantity>1</quantity>
</Item>
<Item>
<username date="2019-06-23">
<clientID>3</clientID>
</username>
<name>Test2</name>
<price>200</price>
<quantity>1</quantity>
</Item>
enter code here
<!-------- Expected:
<project>
<Item>
<username date="2019-06-23">
<clientID>3</clientID>
</username>
<name>Test2</name>
<price>200</price>
<quantity>1</quantity>
</Item>
</project>
Actual results: The above code is generating errors. P.S: I just started to learn how to use XPATH, i am having problem in understanding how the syntax works.