Hi there... I have to create an xml string to be sent over a socket connection from some data coming from a database. I could hard code all the xml tags but is tedious and error prone...can anybody help me with this? Thanks thanks thanks
SAFROLE M3
Greenhorn
Joined: Jun 28, 2001
Posts: 18
posted
0
Create a template XML file as text that already has the tags defined, then simply read the file into a DOM and populate the DOM dynamically with the data from the database. SAF
Ajith Kallambella
Sheriff
Joined: Mar 17, 2000
Posts: 5781
posted
0
Your name 'SAFROLE M3' does not comply with the JavaRanch naming policy. Please spare a moment and re-register with a name that meets the requirements. . Thanks!
Open Group Certified Master IT Architect.
Sun Certified Architect(SCEA).
Agnese Maria
Greenhorn
Joined: Jul 06, 2001
Posts: 2
posted
0
Thanks Safrole...do you have code samples that do that?
SAFROLE M3
Greenhorn
Joined: Jun 28, 2001
Posts: 18
posted
0
Sheriff, I'm not changing my name because I highly doubt another individual will attempt to register with a name that conflicts with mine. Agnese, This is a simple task. First, define a text file that acts as a template for your application. This file should be a well-formed XML document that contains tags with no values, so self-terminating tags will do, such as </tagName>. Now, read your text file using InputStream to get the document contents into a DOM object. Once you have a DOM, you can navigate through it using the DOM API and insert values into your DOM as you see fit. SAF
Ajith Kallambella
Sheriff
Joined: Mar 17, 2000
Posts: 5781
posted
0
SAF, I am sorry I can't make an exception in your case. The rule has to be followed by all registered users.