+ Start a Discussion
shinerajbshinerajb 

xml traversal

i need to traverse through 4 levels in an XML using apex can some body suugest a method for doing that


example

<left1><left2>
<left3>
<left4>
help
</left4></left3>
</left2></left1>


i need to get the value of ""help"".Can some body suggest a way of traversing a large amount of elements in xml

Shine

shinerajbshinerajb

I went to the link but that deals with one level of xml. i have to traverse 4 levels in xml thats my problem

regards

Shine

mohimohi

public XMLDom dom;
dom=new XMLDom(xml in string format);
for(xmldom.element e: dom.getElementsByTagName('left3'))
{
string str1=e.getValue('left4');
}

 

you May use like that.if this insight your solution Please mark as accepted