PDA

View Full Version : Reg XML Tree



sreekanthjup
11 Aug 2009, 12:55 AM
Hi all,

I have an xml datagram which is strictly having only this structure:



<?xml version="1.0" ?>
- (http://product2/heirarchical.xsql#) <ROWSET>
- (http://product2/heirarchical.xsql#) <ROW num="1">
<LEVEL>1</LEVEL>

<EMPNO>1909</EMPNO>

<MGR>0</MGR>

</ROW>


- (http://product2/heirarchical.xsql#) <ROW num="2">
<LEVEL>1</LEVEL>

<EMPNO>1299</EMPNO>

<MGR>0</MGR>

</ROW>


- (http://product2/heirarchical.xsql#) <ROW num="3">
<LEVEL>1</LEVEL>

<EMPNO>4850</EMPNO>

<MGR>0</MGR>

</ROW>


- (http://product2/heirarchical.xsql#) <ROW num="4">
<LEVEL>1</LEVEL>

<EMPNO>1277</EMPNO>

<MGR>0</MGR>

</ROW>


- (http://product2/heirarchical.xsql#) <ROW num="5">
<LEVEL>2</LEVEL>

<EMPNO>1201</EMPNO>

<MGR>1277</MGR>

</ROW>


- (http://product2/heirarchical.xsql#) <ROW num="6">
<LEVEL>3</LEVEL>

<EMPNO>1202</EMPNO>

<MGR>1201</MGR>

</ROW>


- (http://product2/heirarchical.xsql#) <ROW num="7">
<LEVEL>3</LEVEL>

<EMPNO>1203</EMPNO>

<MGR>1201</MGR>

</ROW>


</ROWSET>




There should be 3 levels in tree, i want all the level 3 employee no's first and then under them level 2 and then level 1 employee no's.

How would i construct the tree with extjs toolkits sprcifically from XML data.

Regards,
Sreekanth.

Animal
11 Aug 2009, 1:26 AM
You would have to preprocess that XML document using DomQuery to extract the data from it to create the tree structure.

sreekanthjup
11 Aug 2009, 2:15 AM
Hi Animal,

Thankyou for immediate reply, can you just give me a small example.

Animal
11 Aug 2009, 2:28 AM
"example"?

You mean write the code. You can't give an "example" of translating exactly that XML into a tree structure without diong the work.

sreekanthjup
11 Aug 2009, 2:35 AM
No not exactly that XML, I am a naive user, so i have been seeing to DomQuery API but coudnt get comfortable. So i was asking if there is any example of how an XML document is queried using DOM QUERY.

Animal
11 Aug 2009, 2:37 AM
There's an XML treeloader example in your examples directory IIRC

The API docs for DomQuery are pretty good: http://extjs.com/deploy/dev/docs/?class=Ext.DomQuery