473,322 Members | 1,736 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Convert a file to xml

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

Jul 18 '05 #1
1 2122
> 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 Strange hierarchy....
<Class :Thing>
<Class :KoalaWithPhD>
<Class :MaleStudentWith3Daughters>
<Class :Habitat>
....
.....
</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/tutor...ted/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/tutor...a/strings.html
5. Using stacks in Java
http://java.sun.com/j2se/1.4.2/docs/...til/Stack.html

HTH
Piet
Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: hunterb | last post by:
I have a file which has no BOM and contains mostly single byte chars. There are numerous double byte chars (Japanese) which appear throughout. I need to take the resulting Unicode and store it in a...
7
by: whatluo | last post by:
Hi, all I'm now working on a program which will convert dec number to hex and oct and bin respectively, I've checked the clc but with no luck, so can anybody give me a hit how to make this done...
1
by: Daniel | last post by:
I have looked everywhere on the web for an answer to this and the only thing I can find is converting the image format when the file is present on the local filesystem. What I want to do is use a...
7
by: Scott Schluer | last post by:
Is there a way to use the Image class to convert a color photo (GIF or JPEG) to a B&W photo? Thanks, Scott
3
by: Thubaiti | last post by:
Hi, I have this code in my ASP.NET and I want to convert it to C# (code behind) <asp:Repeater id="subCategoryRepeater" runat="server"> <ItemTemplate> <ul> <li> <asp:HyperLink...
12
by: Brian Henry | last post by:
first question... I have a flat file which unfortinuatly has columns seperated by nulls instead of spaces (a higher up company created it this way for us) is there anyway to do a readline with this...
5
by: melickas | last post by:
We designed a custom application using Office Developer Tools '97 which included a Run-time version of Access--- so it would not matter if our customer even had any version of Access on their...
6
by: PenguinPig | last post by:
Dear All Experts I would like to know how to convert a HTML into Image using C#. Or allow me contains HTML code (parsed) in Image? I also tried this way but it just display the character "<" &...
5
by: sonu | last post by:
hey good morning ...... how to convert a video file in .flv format in php for linux hosting......is there any package whis provide this facility . Can i use ffmpeg for linux hosting...
0
Debadatta Mishra
by: Debadatta Mishra | last post by:
Introduction In this article I will provide you an approach to manipulate an image file. This article gives you an insight into some tricks in java so that you can conceal sensitive information...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.