Basically, I have an Html file full of Divs without major variations between them. So:
<div id="all-divs" class="number1">
<div class="generaldiv">
<div class="randomclass">
<input value="2874973" name="foo1" class="foo2" id="fooid" type="checkbox"/>
<label class="rand" for="rand2-2874973">Text</label>
</div>
</div>
</div>
<div id="all-divs" class="number2">
<div class="generaldiv">
<div class="randomclass">
<input value="2874974" name="foo1" class="foo2" id="fooid" type="checkbox"/>
<label class="rand" for="rand2-2874973">Text</label>
</div>
</div>
</div>
Class numbers change dynamically so there is no way to know them before reviewing the file.
At this time, I need to do the following:
Extract the number located in input value
Modify the name of the Main Div with the purpose of adding the related number in the input. For Our example it would be
From
<div id="all-divs" class="number1">
A
<div id="all-divs-2874973" class="number1">
I have managed to extract the input number without problems, using Xpath:
$finder = new DomXPath($dom);
$nodes = $finder->query('//input[@class="foo2"]');
$nodevalue = $nodes->item(0);
$atribute = $nodevalue->getAttribute('value');
However, I need to modify the DIV all-divs without success as I mentioned earlier.
I thank you in advance for your help.