Naresh Ramaswamy <tech4me / in.com> 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}

That seems like a mistake. An XML document *is* a form of data storage -
think of it as a kind of database - and it is impossible to represent an
arbitrary XML document in some *other* form. So I suggest that you
should read the XML document and *not* store it an array; just leave it,
and use REXML to explore it and manipulate it.

> 
> *** 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.

XPath? Isn't this what XPath is *for*?

I suggest reading a good book about XML. It can be an eye-opening
experience...! :)

m.

-- 
matt neuburg, phd = matt / tidbits.com, http://www.tidbits.com/matt/
Leopard - http://www.takecontrolbooks.com/leopard-customizing.html
AppleScript - http://www.amazon.com/gp/product/0596102119
Read TidBITS! It's free and smart. http://www.tidbits.com