Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / November 2006

Tip: Looking for answers? Try searching our database.

Reg  parsing Design

Thread view: 
sivga - 09 Nov 2006 18:41 GMT
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
sivga - 09 Nov 2006 20:41 GMT
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
Oliver Wong - 09 Nov 2006 20:55 GMT
> 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



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.