Robert Klemme
2/19/2009 7:35:00 AM
On 19.02.2009 07:24, Naresh Ramaswamy wrote:
> hi,
>
> I am reading an XML document and storing in a array.
> Now I need to search for presence of a particular element and
>
> array = {elements of XML Document}
> array[1] = {chile elelments of XML document}
>
> *** I want to ***
> search if element X or Y or Z exists
> if
> X exists
> Do this
> elsif Y exists
> Do this
> else
> Do This
> end
>
> I am not finding any way to search for elelemtns in XML file.
> Please provide your solution.
XPath. You can find it in REXML's tutorial section.
> My XML file looks like this
>
> <TXN value = '3'>
> <SEND request = 'X' > <!- This can be either X or Y or Z -->
> <MODIFY val1 = 'from' val2 = 'Show' val3 = '200'/>
> </SEND>
> </TXN>
>
> I am using REXML solution to play with Ruby file.
It is not clear to me how you do the array storage. With REXML you
basically just need to read the document. Then you can operate on the
DOM. At the moment I do not see a need for you to separately store
something in an Array. Can you be more specific about what your program
does - and how?
Kind regards
robert
--
remember.guy do |as, often| as.you_can - without end