Hi all i wan to whether the right approach for the design is corerct.
this is wat my input xml going to be
<Transactions>
<transctionList>
<Trans name="ADD_AG">
<childTrans>ADD_ED</childTrans>
<childTrans>ADD_CD</childTrans>
</Trans>
<Trans name="ADD_ED">
< actionIntf>add_r</actionIntf>
<actionIntf>add_ml</actionIntf>
<actionIntf>sub_mlk</actionIntf>
</Trans>
<Trans name="ADD_CD">
<actionIntf>add_rkm</actionIntf>
<actionIntf>sub_mlcd</actionIntf>
<actionIntf>sub_mlki</actionIntf>
</Trans>
</transactionList>
</Transactions >
input to the java program will be xml file and Trans name so for eg
when the input is ADD_AG i need to check whether it has any child and
if it is then nee to get all the elements underneath it ..so in this
case we have two child elements so the output should be
ADD_AG
ADD_ED
add_r
add_ml
sub_mlk
Add_CD
add_rkm
sub_mlcd
sub_mlki
when the input is goin to be ADD_ED ( this does not have any child so
)the output is
ADD_ED
add_r
add_ml
sub_mlk
planning to use Jdom and create a tree structure and then store each
node and its contents in alist ...is this approach corerct . after
storing it in a list how do i associate ie check that it has child or
not .
or is is possible to produce a tree structure with above xml like
add_AG ->ADD_ED->add_r ......
Add_cd -> add_rkm ..... etc
..what is the right approach to take ..thanks for the help
hi is there a way i an do this this any help pls .
thanks
> Hi all i wan to whether the right approach for the design is corerct.
> this is wat my input xml going to be
[quoted text clipped - 53 lines]
>
> ..what is the right approach to take ..thanks for the help
> Hi all i wan to whether the right approach for the design is corerct.
> this is wat my input xml going to be
[quoted text clipped - 43 lines]
> planning to use Jdom and create a tree structure and then store each
> node and its contents in alist ...is this approach corerct .
This approach sounds fine to me.
> after
> storing it in a list how do i associate ie check that it has child or
> not .
Assuming each item in your list is one of those Trans element, you can
just ask the element whether or not it has children.
- Oliver
sivga - 09 Nov 2006 21:07 GMT
thanks oliver so the approach woould be to build a tree store all its
elements in a list and then manipulate the list ie looking each list
whether it has elements right ?
> > Hi all i wan to whether the right approach for the design is corerct.
> > this is wat my input xml going to be
[quoted text clipped - 54 lines]
>
> - Oliver
Oliver Wong - 09 Nov 2006 21:12 GMT
> thanks oliver so the approach woould be to build a tree store all its
> elements in a list and then manipulate the list ie looking each list
> whether it has elements right ?
I'd use a hashtable, and I wouldn't store all the elements (only the
Trans elements) but otherwise yes.
- Oliver
Mark Jeffcoat - 09 Nov 2006 22:08 GMT
> thanks oliver so the approach woould be to build a tree store all its
> elements in a list and then manipulate the list ie looking each list
> whether it has elements right ?
If you squint at that paragraph just right, it describes
every reasonable algorithm on an XML document interpreted
with the Document Object Model.
Just do it. Nobody's going to be able to give you a complete
tutorial on designing programs in a single post. If you
get stuck somewhere, you can ask a more specific question.
By the time you're done, you'll know how to do it better
next time.

Signature
Mark Jeffcoat
Austin, TX