[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] how to construct data - getting confused ...... converting native datato
Hi, guys: After couple of hours work - I got a situation that I should decide how to construct my data - OK, here's the case, maybe some fo your guys can help me out or give me a guide: Background: I wrote a Data Objects ( Java/CORBA based ) and it takes data from Sybase through JDBC - then the data needs be re-constructed into XML data stream, here's how the data looks like: parent root ( with ID ) Child Level 1 ( with parent root ID and its-self unique ID) Child Level 2 ( with Child Level 1 ID as parent ID and its-self unique ID ) Child Level 3 ( with Child Level 2 ID as parent ID and its-self unique ID ) ......... to unknown level N and there're multi-parent roots, so the tree structure above will be multi-level based, like this: parent root1 ( with ID ) Child Level 1-1 ( with parent root ID and its-self unique ID) Child Level 1-2 ( with Child Level 1-1 ID as parent ID and its-self unique ID ) Child Level 1-3 ( with Child Level 1-2 ID as parent ID and its-self unique ID ) parent root2 ( with ID ) Child Level 2-1 ( with parent root ID and its-self unique ID) Child Level 2-2 ( with Child Level 2-1 ID as parent ID and its-self unique ID ) Child Level 2-3 ( with Child Level 2-2 ID as parent ID and its-self unique ID ) parent root3 ( with ID ) Child Level 3-1 ( with parent root ID and its-self unique ID) Child Level 3-2 ( with Child Level 3-1 ID as parent ID and its-self unique ID ) Child Level 3-3 ( with Child Level 3-2 ID as parent ID and its-self unique ID ) ......... to unknown level N and since the level of child is un-known, it comes the question ?? -> I need create a XML stream to host the data model above - and the way I am writing right now is to create a collection to handle a generic TREE ( e.g. parent root1 ), then adding the other available TREEs into the same collections, and this collection is linking to a HashMap, so the client side Applet can point to - NOW SINCE I DID NOT KNOW HOW MANY LEVEL CHILDS I CAN HAVE , looks like I can not finish constructing the generic TREE structure, and CAN SOME ONE HELP ME to find a way to resolve this - in a world, how to convert the unknown type of collection ( Vector in Java ) and embed it into a XML stream ???? - one way I am thinking about this question is that I can retrieve the level of child when I retrieve the data from database, then construct the TREE - then how I should design my DTD or schema .... ???
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|