dimanche 28 juin 2015

XML change value where attribute is

With PHP I want to change the value in the node where attribute is something I specify. The XML file:

<?xml version='1.0' standalone='yes'?>
<days>
<Maandag     id="1">0</Maandag>
<Dinsdag     id="2">0</Dinsdag>
<Woensdag    id="3">0</Woensdag>
<Donderdag   id="4">0</Donderdag>
<Vrijdag     id="5">0</Vrijdag>
<Zaterdag    id="6">0</Zaterdag>
<Zonday      id="0">0</Zonday>      
</days>

For example: Today is Monday so jddayofweek(0) = 1 Then the value of the node with id=1 needs to change, so in the end we get:

<?xml version='1.0' standalone='yes'?>
<days>
<Maandag     id="1">3</Maandag>
<Dinsdag     id="2">0</Dinsdag>
<Woensdag    id="3">0</Woensdag>
<Donderdag   id="4">0</Donderdag>
<Vrijdag     id="5">0</Vrijdag>
<Zaterdag    id="6">0</Zaterdag>
<Zonday      id="0">0</Zonday>      
</days>

How do I do this in PHP?

Aucun commentaire:

Enregistrer un commentaire