function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ 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