473,386 Members | 1,644 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,386 software developers and data experts.

How to convert a text data into xml data?

Hai to all...
this is senthil....

i want to convert a text data into a xml data....

is there any source codes available in the net?

or is there any methods, classes available for this type of conversion?

Can any one plzz tell me?

thanks
senthil.
Dec 27 '06 #1
11 5562
Hai any one plzz explain me about this...

i will explain u clearly what i have to do....

Expand|Select|Wrap|Line Numbers
  1. i'm having XML codings for creating a table in a mysql database...
  2.  
  3. these xml codings are written into a single field in a database...
  4.  
  5. what i have to do is...
  6.  
  7. i have to write these xml codings into a file in which the file
  8. to be saved as xml file...
Can any one plzz explain me
Dec 28 '06 #2
r035198x
13,262 8TB
Hai any one plzz explain me about this...

i will explain u clearly what i have to do....

Expand|Select|Wrap|Line Numbers
  1. i'm having XML codings for creating a table in a mysql database...
  2.  
  3. these xml codings are written into a single field in a database...
  4.  
  5. what i have to do is...
  6.  
  7. i have to write these xml codings into a file in which the file
  8. to be saved as xml file...
Can any one plzz explain me
Well you asked for available codes which I do not have. I'm not very good at XML so the only way I can solve your problem is to "manually" create the XML
using FileWriter class. How to do this would depend on the structure of data in the text file and the structure required for the XML file. If that is not good enough for you then maybe someone else who knows a conventional method of creating the XML file will be able to help you.
Dec 28 '06 #3
Hai r035198x,

thanks for ur reply....

i will explain u till clearly what i have to do...

plzz give me some more hints after that

Expand|Select|Wrap|Line Numbers
  1. i'm having XML codings for creating a table in a mysql database...
  2.  
  3. these xml codings are written into a single field in a database...
  4.  
  5. what i have to do is...
  6.  
  7. i have to retrive these xml codings into a file in which the file
  8. to be saved as xml file... 
  9.  
  10. retriving is not a problem to me...
  11.  
  12. But i have to save that retrived xml codings into a xml file...
plzz give me some more hints..

thanks..
senthil..
Dec 28 '06 #4
r035198x
13,262 8TB
Hai r035198x,

thanks for ur reply....

i will explain u till clearly what i have to do...

plzz give me some more hints after that

Expand|Select|Wrap|Line Numbers
  1. i'm having XML codings for creating a table in a mysql database...
  2.  
  3. these xml codings are written into a single field in a database...
  4.  
  5. what i have to do is...
  6.  
  7. i have to retrive these xml codings into a file in which the file
  8. to be saved as xml file... 
  9.  
  10. retriving is not a problem to me...
  11.  
  12. But i have to save that retrived xml codings into a xml file...
plzz give me some more hints..

thanks..
senthil..
Are these XML codings strings that you have to convert to XML tags?
If so what is the structure of the strings(What tells you when a tag should be started and ended)?
Dec 28 '06 #5
No no...

in the database....

there is xml codings for creating a table with xml tags which is now just like
the followilng
<xml>
<codings for creating a table>
</xml>

Only i have to retrive these codings(just like retriving an information)
from the database and i have to write these codings into a file in which
the file to be saved as xml file...

can u get any idea...

thanks
senthil
Dec 28 '06 #6
r035198x
13,262 8TB
No no...

in the database....

there is xml codings for creating a table with xml tags which is now just like
the followilng
<xml>
<codings for creating a table>
</xml>

Only i have to retrive these codings(just like retriving an information)
from the database and i have to write these codings into a file in which
the file to be saved as xml file...

can u get any idea...

thanks
senthil
I get the picture. I still don't think I'm the best person to help you on this but

You said you can retrieve these codings. How are you retrieving them? As strings or some other data type?
Dec 28 '06 #7
Only i can retrive them as strings...
Dec 28 '06 #8
r035198x
13,262 8TB
Only i can retrive them as strings...
if you can retrieve as strings then maybe this might help. It creates the file from an array of strings

Expand|Select|Wrap|Line Numbers
  1. import java.io.*;
  2. public class WriteFile {
  3.          public static void main(String[] args) {
  4.     try {
  5.         File file = new File("test.xml");
  6.         BufferedWriter out = new BufferedWriter(new FileWriter(file));
  7.         String[] ss = {"<XML>", "<Test>", "</TEST>", "</XML>"};
  8.         for(int i = 0;i < ss.length; i++) {
  9.             out.write(ss[i]);
  10.             out.newLine();
  11.             out.flush();
  12.         }
  13.     }
  14.     catch(IOException io) {
  15.         io.printStackTrace();
  16.     }
  17.     }
  18. }
Dec 28 '06 #9
Hai,

very very thanks for ur support and guidance....

i want to do some modifications in ur program,

bcoz i have to retrive that string from database...

i will try it and tell to u what the result is.

thanks...
senthil
Dec 28 '06 #10
r035198x
13,262 8TB
Hai,

very very thanks for ur support and guidance....

i want to do some modifications in ur program,

bcoz i have to retrive that string from database...

i will try it and tell to u what the result is.

thanks...
senthil
Welcome. Instead of the array and for loop you now sbstitute that with the values coming from the database.
Dec 28 '06 #11
Hai r035198x
ur conditions worked supervly
when i used for writing a string into a file...

But when i tried to writed the string which is fetched from the database
it is not working....

But anyway i will do the second step surely....

basically i'm working in the field of VC++....

But ur codings gave me an idea to write a file...

Hereafter i will do my work well...

thanks for ur support
senthil
Dec 29 '06 #12

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Andrew V. Romero | last post by:
At work we have an excel file that contains the list of medications and their corresponding strengths. I would like to save the excel file as a text list and paste this list into a javascript...
1
by: Swarup | last post by:
I am reading a file (txt, xml, gif, ico, bmp etc) byte by byte and filling it into a byte arry. Now i have to convert it into a string to store it in the database. I use...
6
by: Ricardo Quintanilla | last post by:
i have a code that sends data to a socket listening over as400 platform, the socket responds to me as a "byte array". then i need to convert the "byte array" into a string. the problem is that...
5
by: manmit.walia | last post by:
Hello All, I am stuck on a conversion problem. I am trying to convert my application which is written in VB.NET to C# because the project I am working on currently is being written in C#. I tried...
2
by: Learner | last post by:
Hello, I am trying to store the data entered in a webform in the database. I have few Int and one SmallDateTime filed in my table in SQL Server 2005 database. I have made a storedproc to store the...
0
by: Andy | last post by:
Hi, I have a MS Word binary data file that is sent from my .NET webservice in response to an XMLHTTP request from an Internet Explorer client. This data has to be base64 encoded to tunnel through...
3
by: mrajanikrishna | last post by:
Hi Friends, I am accepting a number from the user entered in a textbox. I want to assign to a variable in my code and assignt this to that variable. double num1 = (double)txtNum1.text; ...
5
by: Elainie | last post by:
I would like to convert data numbers to text.... i.e. 1 = Inactive 2 = Due 3 = Received 4 = Problems 5 = Cleared Their is numbers in the fields at the moment but they need to be converted to...
6
by: Bob Altman | last post by:
Hi all, I'm looking for the fastest way to convert an array of bytes to String. I also need to convert a String back to its original Byte() representation. Convert.ToBase64String and...
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.