• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

how to convert java string into XML format ???

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hai all,
how to convert java string into XML format and convert XML to java string ??? (this should be dynamic during run time ). if there is any solution help me ....

ex: i'm having string array which was readed from a file . then i want to convert it into XML format to C++ structure ...
from C++ structure i will get the Reply as XML format .. then i want to convert it into java string format...
send me Some sample Code if any......

[ EJFH: Remove invitation to take discussion offline ]
[ February 07, 2005: Message edited by: Ernest Friedman-Hill ]
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Please don't ask people to email you answers to your questions. If the answers are posted here, then other people can benefit from them, as well.

Your question is very vague, and the answers depend on exactly what the various formats you're talking about would look like. Perhaps you could explain in a bit more detail, showing brief, accurate examples of the data you want to convert, and what you want to convert it to.
 
dhana sss
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hai Ernest Friedman-Hill ,
i'm reading text file and store the text file in a string variable . then i want to convert the string into a xml format .

this is my clear question.. if u need more details other than this tell me

by
dhana
 
Ranch Hand
Posts: 375
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If I understand the question correctly, you wish to convert raw text into a valid XML document. If this is the case, it should be trival with the amount of free XML Parsers available. I would suggest using JDOM for this. You can easily set the text for whichever XML element you want. Get all the data into variables and then build an XML document, add elements and attributes as appropiate and output to file.
 
dhana sss
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Kashif Riaz and all ,

for giving me idea to use JDOM .... another one question friends .....
i want to convert the XML file to String or RTF or Text file . if there is any solution tell ... and any sample code if any ..

thanks by
dhana
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The subject of converting XML formatted data to text, RTF, PDF or HTML gets huge thick books - some of which are littering my desk right now....
You should ask for suggestions in the XML and Related Tech forum.
Bill
[ February 08, 2005: Message edited by: William Brogden ]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic