[SunONE-JATO] Build TreeView Using XML
First, let me be clear that if you don't HAVE to use a JATO
TreeModel/TreeView, though it may be the easiest approach. The alternative
would be to write a component that takes the XML file directly and generates
HTML from it. You would then just need to slap the HTML into the response
as needed.
If you are going to use a TreeModel/TreeView, you need to extend from
AbstractTreeModel and fill in the missing methods. These should be very
easy to do using the DOM API. (Note, you will have to fill in the gap as to
how the model actually obtains the XML document it needs to work with--that
is an application decision.) You will certainly have to use SOME data
structure to contain the parsed XML--the model in this case has no storage
mechanism. It relies on the implementor to provide that, and DOM is
perfectly suited to this use case.
After you've finished the TreeModel implementation, you're reafy to go--just
follow the TreeView + tree tag example in JatoSample to display the model.
Todd
-- Original Message --
From: "Purvashada" <<a href="/group/SunONE-JATO/post?protectID=197075091084158233170098004140114164134 058066051209171188199">purvashada@y...</a>>
Sent: Monday, December 02, 2002 10:57 PM
Subject: [SunONE-JATO] Build TreeView Using XML
>
> I have to build a TreeView model using XML
> data which has tree structure.
>
> I am not sure how to tie the data from XML to
> Treeviewmodel. DO I have to have another data
> structure after parsing XML or directly parsing
> I can attach it to model
>
> The Tree model will be used in the tree view bean to
> display data in the form of tree.
>
> Thanks
> Purvashada
>
> __
>
>
>
> To download the latest version of S1AF (JATO), please visit one of the
following locations:
>
> Framework + IDE plugin for Sun ONE Studio 4 Update 1, Community Edition:
> <a href="http://wwws.sun.com/software/download/products/Appl_Frmwk_2.0_CE.html"> ;http://wwws.sun.com/software/download/products/Appl_Frmwk_2.0_CE.html</a>
>
> Framework + IDE pluign for Sun ONE Studio 4 Update 1, Enterprise Edition:
> <a href="http://wwws.sun.com/software/download/products/Appl_Frmwk_2.0_EE.html"> ;http://wwws.sun.com/software/download/products/Appl_Frmwk_2.0_EE.html</a>
>
> Previous versions of JATO:
> <a href="http://www.sun.com/software/download/developer/5102.html">http://www.s un.com/software/download/developer/5102.html</a>
>
>
>
>
>
[2899 byte] By [
Guest] at [2007-11-25 9:27:09]

Thanks. One Last clarification on this statement.
Do I need separate data structure as in your
examples (Node) or can I just use the DOM and the DOM API's
directly?
>You will certainly have to use SOME data
> structure to contain the parsed XML--the model in this case has no
storage
> mechanism. It relies on the implementor to provide that, and DOM is
> perfectly suited to this use case.
Thanks
In <a href="/group/SunONE-JATO/post?protectID=246075234167171124217231170221059165026 048139046">SunONE-JATO@y...</a>, Todd Fast <<a href="/group/SunONE-JATO/post?protectID=101233080150035167169232031248066208071 048">Todd.Fast@S...</a>> wrote:
> First, let me be clear that if you don't HAVE to use a JATO
> TreeModel/TreeView, though it may be the easiest approach. The
alternative
> would be to write a component that takes the XML file directly and
generates
> HTML from it. You would then just need to slap the HTML into the
response
> as needed.
>
> If you are going to use a TreeModel/TreeView, you need to extend
from
> AbstractTreeModel and fill in the missing methods. These should be
very
> easy to do using the DOM API. (Note, you will have to fill in the
gap as to
> how the model actually obtains the XML document it needs to work
with--that
> is an application decision.) You will certainly have to use SOME
data
> structure to contain the parsed XML--the model in this case has no
storage
> mechanism. It relies on the implementor to provide that, and DOM is
> perfectly suited to this use case.
>
> After you've finished the TreeModel implementation, you're reafy to
go--just
> follow the TreeView + tree tag example in JatoSample to display the
model.
>
> Todd
>
> -- Original Message --
> From: "Purvashada" <<a href="/group/SunONE-JATO/post?protectID=197075091084158233170098004140114164071 048139">purvashada@y...</a>>
> Sent: Monday, December 02, 2002 10:57 PM
> Subject: [SunONE-JATO] Build TreeView Using XML
>
>
> >
> > I have to build a TreeView model using XML
> > data which has tree structure.
> >
> > I am not sure how to tie the data from XML to
> > Treeviewmodel. DO I have to have another data
> > structure after parsing XML or directly parsing
> > I can attach it to model
> >
> > The Tree model will be used in the tree view bean to
> > display data in the form of tree.
> >
> > Thanks
> > Purvashada
> >
> > __
> >
> >
> >
> > To download the latest version of S1AF (JATO), please visit one of
the
> following locations:
> >
> > Framework + IDE plugin for Sun ONE Studio 4 Update 1, Community
Edition:
> >
<a href="http://wwws.sun.com/software/download/products/Appl_Frmwk_2.0_CE.html"> ;http://wwws.sun.com/software/download/products/Appl_Frmwk_2.0_CE.html</a>
> >
> > Framework + IDE pluign for Sun ONE Studio 4 Update 1, Enterprise
Edition:
> >
<a href="http://wwws.sun.com/software/download/products/Appl_Frmwk_2.0_EE.html"> ;http://wwws.sun.com/software/download/products/Appl_Frmwk_2.0_EE.html</a>
> >
> > Previous versions of JATO:
> > <a href="http://www.sun.com/software/download/developer/5102.html">http://www.s un.com/software/download/developer/5102.html</a>
> >
> >
> >
> >
> >
Guest at 2007-7-1 16:32:00 >
