samir25
asked on
xmldom getlength gives me only 1?
hi here is a snippet of my xml; when i do this in my pl.sql i get a count of 1? why is this so? i want to know the total no of nodes within <Parameters> so that i can run the loop.
nl := xmldom.getElementsByTagNam e(doc, 'Parameters');
len := xmldom.getLength(nl);
htp.p('Length : ' || len);
<?xml version="1.0" encoding="utf-8"?>
<TestData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Status>CompletedNormally< /TestCompl etionStatu s>
<ComputerName>DUILT10</Com puterName>
<StartTime>2008-03-19T15:1 2:23</Star tTime>
---Some more noded----
<Parameters>
<RangeMeasured>
<Name>PDissBol-5[C]</Name>
<Min>1.22</Min>
<Max>1.36</Max>
<Units>W</Units>
</RangeMeasured>
<TextMeasured>
<Name>ComputerName</Name>
<Value>DUILT10</Value>
</TextMeasured>
<RangeMeasured>
<Name>TrackError25[C]To-5[ C]</Name>
<Min>0.031</Min>
<Max>0.041</Max>
<Units>dB</Units>
</RangeMeasured>
<RangeMeasured>
<Name>Power-5[C]</Name>
<Min>1.988</Min>
<Max>1.061</Max>
<Units>dBm</Units>
</RangeMeasured>
---some more nodeds---
</Parameters>
</TestData>
nl := xmldom.getElementsByTagNam
len := xmldom.getLength(nl);
htp.p('Length : ' || len);
<?xml version="1.0" encoding="utf-8"?>
<TestData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Status>CompletedNormally<
<ComputerName>DUILT10</Com
<StartTime>2008-03-19T15:1
---Some more noded----
<Parameters>
<RangeMeasured>
<Name>PDissBol-5[C]</Name>
<Min>1.22</Min>
<Max>1.36</Max>
<Units>W</Units>
</RangeMeasured>
<TextMeasured>
<Name>ComputerName</Name>
<Value>DUILT10</Value>
</TextMeasured>
<RangeMeasured>
<Name>TrackError25[C]To-5[
<Min>0.031</Min>
<Max>0.041</Max>
<Units>dB</Units>
</RangeMeasured>
<RangeMeasured>
<Name>Power-5[C]</Name>
<Min>1.988</Min>
<Max>1.061</Max>
<Units>dBm</Units>
</RangeMeasured>
---some more nodeds---
</Parameters>
</TestData>
ASKER
what do you mean by i need to get a DOMElement? how can i do that?
basically i need to find a child inside Parameters node
e.g. <RangeMeasured>
<Name>TrackError25[C]To-5[ C]</Name>
<Min>0.031</Min>
<Max>0.041</Max>
<Units>dB</Units>
</RangeMeasured>
i need to find TrackError25[C]To-5[C]... and if exists then i need to change the min and max.
would you be able to help on this?
basically i need to find a child inside Parameters node
e.g. <RangeMeasured>
<Name>TrackError25[C]To-5[
<Min>0.031</Min>
<Max>0.041</Max>
<Units>dB</Units>
</RangeMeasured>
i need to find TrackError25[C]To-5[C]... and if exists then i need to change the min and max.
would you be able to help on this?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If you want the count of all nodes within Parameters you will need to get a DOMElement and call getchildrenbyname, or otherwise iterate through the nodes inside that node and count them