Hi,
I am completely new to java and i am trying to create a tree of an
output i have. generally the output is tab delimited and i have a
sample output as below.
Class :Thing
Class :KoalaWithPhD
Class :MaleStudentWith3Daughters
Class :Habitat
Class :Forest
Class :Rainforest
Class :DryEucalyptForest
Class :University
Class :Female
Class :Student
Class :GraduateStudent
Class :Degree
Class :Gender
Class :Male
I want to create an xml out of it in the tree format as below
<Class :Thing>
<Class :KoalaWithPhD>
<Class :MaleStudentWith3Daughters>
<Class :Habitat>
....
.....
</Class :Thing>
Can someone throw in a simple code snipet that can help me do this.
Really appreciate your help
Thanks
aks
Piet - 25 Mar 2005 17:57 GMT
> Class :Thing
> Class :KoalaWithPhD
[quoted text clipped - 10 lines]
> Class :Gender
> Class :Male
Strange hierarchy....
> <Class :Thing>
> <Class :KoalaWithPhD>
[quoted text clipped - 3 lines]
> .....
> </Class :Thing>
This is not an XML file, not even a snippet of it.
You may want to have a look at the following links
XML tutorial:
http://www.zvon.org/xxl/XMLTutorial/General/book.html
2. Java Tutorial
http://java.sun.com/docs/books/tutorial/getStarted/index.html
3. Java and XML
http://java.sun.com/xml/jaxp/docs.html
I guess that these two more specialized links will also be useful:
4. String handling tutorial in Java
http://java.sun.com/docs/books/tutorial/java/data/strings.html
5. Using stacks in Java
http://java.sun.com/j2se/1.4.2/docs/api/java/util/Stack.html
HTH
Piet