I have an XML file:
<wave waveID="1">
<well wellID="1" wellName="A1">
<oneDataSet>
<rawData>0.1123975676</rawData>
</oneDataSet>
<well>
I am trying to print the wellName attribute with the following code:
my @n1 = $xc->findnodes('//ns:wave[@waveID="1"]');
foreach $nod1 (@n1) {
my @wellNames = $nod1->getElementsByTagName('well');
foreach $well_name (@wellNames) {
print $well_name->textContent;
print "\n";
}
but instead of printing out the name wellName, I am printing rawData values (e.g. 0.1123975676). I don’t understand why, right? I tried to comment on the code in order to understand what is happening, but if the comments are incorrect, please correct me. Thank.
source
share