Well, I'm back with my problems reading XML.
Let's put this XML example
<TED>
<FORM_SECTION>
<SECC_1>
....
<SECC_2>
....
<SECC_3>
....
With simpleXML to access the SECC_X it would be as simple as
$xml->FORM_SECCTION->SECC_X->xxxxx
But the problem I have is that SECC_N is a number that is not always determined, nor with consecutive numbers, and not even with the same format, here we have SECC_X but in other cases it can be called CASE_X for example, or MODELO_X or anything else, so that I need, somehow to be able to "know" the name of the nodes.
I have tried something like this
$secciones = $xml->FORM_SECTION;
foreach ($secciones as $seccion => $name) {
echo "seccion : $seccion - name: $name<br>";
}
But $name doesn't tell me the name of the child nodes of FORM_SECTION and $section literally returns FORM_SECCTION
I'm sure it's much easier than I'm thinking but... I'm not right
You can use
getName()
, combined withchildren()
.For example: