I have a xml file with servers in it.
<?xml version="1.0" encoding="UTF-8"?> <servers> <server> <location>Belgium</location> <ip>192.168.0.1</ip> <port>8080</port> <crt></crt> </server> <server> <location>Fhoto</location> <ip>192.168.0.5</ip> <port>7841</port> <crt>http://127.0.0.1/serv.crt</crt> </server> <server> <location>TestingPanel</location> <ip>192.168.1.2</ip> <port>6969</port> <crt>http://testingpanel.com/server.crt</crt> </server> <server> <location>TestingPanel2</location> <ip>192.168.1.3</ip> <port>6968</port> <crt>http://testingpanel.com/server1.crt</crt> </server> </servers> I made a php page that can add servers to the file and it works great. Now I want to make a form where you can enter the IP and the php script should delete the whole node.
So for example. I have a form with a textbox and I enter "192.168.0.1". I want it to delete this:
<server> <location>Belgium</location> <ip>192.168.0.1</ip> <port>8080</port> <crt></crt> </server> I have this so far (basically nothing):
if (isset($_POST["deleteServer"])) { //do processing } Please guide me in the right direction as I have no idea how to do this. Thanks in advance!
@commercial-at-sign in front of it, then xpath recognizes it as the element (instead of the attribute). - See especially the technique outlined in this answer: stackoverflow.com/a/16062633/367456