[jdom-interest] Transforming flat xml to hierachial xml format

Vijay Mummaneni mvbabu at hotmail.com
Thu Oct 24 15:29:09 PDT 2002


Yes, The grouping was done by the "managerId" relationship.
All the "employees" for a particular manager become the childern
of the manager node.

Thanks
vijay


>From: Philip Nelson <panmanphil at yahoo.com>
>To: Vijay Mummaneni <mvbabu at hotmail.com>, jdom-interest at jdom.org
>Subject: Re: [jdom-interest] Transforming flat xml to hierachial xml format
>Date: Thu, 24 Oct 2002 13:59:17 -0700 (PDT)
>
>I can't say I understand at all how you got the second document from the 
>first,
>but assuming that there is logical ways of grouping folder and leaf by
>managerId, this looks like a better job for XSLT.  While you could use 
>xpath to
>get those relationships in either jdom or xslt, I think xslt is a better 
>choice
>when the documents have little in common.
>
> > I have an xml file that has 100 "Employee" elements. The elements are
> > related (they are from the RDBMS table). Each element is related to 
>another
> > elemnt by employee-manager relationship. Currently it is flat xml file. 
>What
> > I meant is, it looks like (I used JDOM to grab the data from the 
>database) :
> >
> > <Employees>
> >   <employee id="1" name="emp1" managerId="2" />
> >   <employee id="2" name="emp2" managerId="5" />
> >   <employee id="3" name="emp3" managerId="5" />
> >   <employee id="4" name="emp4" managerId="2" />
> >   <employee id="5" name="emp5" />
> > </Employees>
> >
> > I have the above tree as a JDOM document. Here is how I want to 
>transform it
> > :
> >
> > <Employees>
> >      <folder  id="5" name="emp5" >
> >            <folder  id="2" name="emp2">
> >                  <leaf  id="4" name="emp4" />
> >                  <leaf  id="1" name="emp1" />
> >            </folder>
> >            <leaf  id="3" name="emp3" />
> >      </folder>
> > </Employees>
> >
> >
> > Can you pl suggest me a solution, for this transformation.  Is JDOM 
>helpful
> > for the transormation ?
> >
> > Thanks
> > vijay
> >
> >
> >
> >
> > _________________________________________________________________
> > Surf the Web without missing calls! Get MSN Broadband.
> > http://resourcecenter.msn.com/access/plans/freeactivation.asp
> >
> > _______________________________________________
> > To control your jdom-interest membership:
> >
>http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com
>
>
>__________________________________________________
>Do you Yahoo!?
>Y! Web Hosting - Let the expert host your web site
>http://webhosting.yahoo.com/


_________________________________________________________________
Surf the Web without missing calls! Get MSN Broadband. 
http://resourcecenter.msn.com/access/plans/freeactivation.asp




More information about the jdom-interest mailing list