S
steve_marjoribanks
Ok, I'm afraid I haven't got any source code or anything for this
because I've only just started writing this method and I'm a bit
stuck!!!
Basically, I have an XML file which may have any number of 'Layer'
elements within a 'layers' element. Within the Layer elements are
'layerTop' and 'layerBottom' methods like this:
<layers>
<Layer>
<layerTop>
<Points>
<pos>string</pos>
<pos>string</pos>
etc..
</Points>
</layerTop>
<layerBottom>
<Points>
<pos>string</pos>
<pos>string</pos>
etc..
</Points>
</layerBottom>
</Layer>
<Layer>
...
etc...
....
</Layer>
...
...
etc..
...
</layers>
Ok, I am using JDOM and have coded an iterator to iterate through the
'Layer' elements and I have the code to iterate through the <pos>
elements from another part of my aplication.
Each of the groups of 'pos' values (strings) need to be stored in a
different array (or other data structure). That is, there should be
arrays called 'firstLayerTop', 'firstLayerBottom', 'secondLayerTop',
'secondLayerBottom' etc each containg the strings from the 'pos'
elements.
This would be fine, but the problem is that I don't know how many
'Layer' elements there will be within the XML file! How can I allow for
there to be any number of 'Layer' elements and still retrieve and store
the 'pos' data (in a logical, easily retrievable manner).
I've had a good long think about it but just can't think of a solution.
Any help would be greatly appreciated!
Thanks
Steve
because I've only just started writing this method and I'm a bit
stuck!!!
Basically, I have an XML file which may have any number of 'Layer'
elements within a 'layers' element. Within the Layer elements are
'layerTop' and 'layerBottom' methods like this:
<layers>
<Layer>
<layerTop>
<Points>
<pos>string</pos>
<pos>string</pos>
etc..
</Points>
</layerTop>
<layerBottom>
<Points>
<pos>string</pos>
<pos>string</pos>
etc..
</Points>
</layerBottom>
</Layer>
<Layer>
...
etc...
....
</Layer>
...
...
etc..
...
</layers>
Ok, I am using JDOM and have coded an iterator to iterate through the
'Layer' elements and I have the code to iterate through the <pos>
elements from another part of my aplication.
Each of the groups of 'pos' values (strings) need to be stored in a
different array (or other data structure). That is, there should be
arrays called 'firstLayerTop', 'firstLayerBottom', 'secondLayerTop',
'secondLayerBottom' etc each containg the strings from the 'pos'
elements.
This would be fine, but the problem is that I don't know how many
'Layer' elements there will be within the XML file! How can I allow for
there to be any number of 'Layer' elements and still retrieve and store
the 'pos' data (in a logical, easily retrievable manner).
I've had a good long think about it but just can't think of a solution.
Any help would be greatly appreciated!
Thanks
Steve