i have a rather long xml file which i need to parse and i'm not able to 
proceed at a certain point. the code throws up errors when i try to access 
the child nodes of a certain element. 

<?xml version="1.0" encoding="utf-8"?>
<Instance LightXML.version="1" schema="Instance.xsd!>
 <sub></sub>
 <requests>
  <slice class="I" RTT="50.0" profit="1.0" ID="1">
      <TrPts>
        <trpt dnom="1.0" dpeak="0.25" ID="1">
          <VFs>
            <VF name="ST" class="E" delta="0.0" ID="1">
              <suitors>
                <suitor ID="17"/>
              </suitors>
            </VF>
            <VF name="FW" class="V" delta="1.2" ID="2">
              <suitors>
                <suitor ID="1"/>
                <suitor ID="2"/>
                <suitor ID="9"/>
                <suitor ID="11"/>
              </suitors>
            </VF>
            <VF name="GW" class="V" delta="1.2" ID="3">
              <suitors>
                <suitor ID="8"/>
                <suitor ID="12"/>
                <suitor ID="11"/>
                <suitor ID="17"/>
              </suitors>
            </VF>
            <VF name="X8" class="V" delta="1.2" ID="4">
              <suitors>
                <suitor ID="8"/>
                <suitor ID="14"/>
                <suitor ID="3"/>
                <suitor ID="16"/>
              </suitors>
            </VF>
            <VF name="FI" class="E" delta="0.0" ID="5">
              <suitors>
                <suitor ID="1"/>
                <suitor ID="7"/>
                <suitor ID="9"/>
              </suitors>
            </VF>
          </VFs>
          <VFCs>
            <VFC delta="1.2" tailID="1" headID="2" ID="1"/>
            <VFC delta="1.2" tailID="2" headID="3" ID="2"/>
            <VFC delta="1.2" tailID="3" headID="5" ID="3"/>
            <VFC delta="1.8" tailID="1" headID="4" ID="4"/>
            <VFC delta="1.8" tailID="4" headID="5" ID="5"/>
          </VFCs>
        </trpt>
        :
        :
        <trpt dnom="1.6" dpeak="0.4" ID="17">
          <VFs> </VFs>
          <VFCs></VFCs>
        </trpt>
      </TrPts>
    </slice>
    <slice></slice>
<requests>


I suppressed a lot of content and I hpe its okay. The main problem I have 
here is when I access the element requests as 

requests = get_elements_by_tagname(xroot, "requests")
slice_set = get_elements_by_tagname(requests, "slice")

for slice in sliceset
:
:
end

I get an error saying get_elements_by_tagname has no method matching ....
I tried find_element(requests[1], "slice") but that didn't work either. Is 
it possible to parse this hugely complicated file and if yes, how can it be 
handled?

Reply via email to