jQuery in Action, 2nd edition*
The moose likes XML and Related Technologies and the fly likes XML file on fly Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "XML file on fly" Watch "XML file on fly" New topic
Author

XML file on fly

Angela D'souza
Ranch Hand

Joined: Jan 16, 2002
Posts: 469
Hi,
How to create xml file on fly using java object.
Thanks,
Angela
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
I can't understand your exact requirement, any way this link may help you http://www.coderanch.com/t/125765/XML/Java-objects-XML-file-vice


Spritle Software Blogs
Angela D'souza
Ranch Hand

Joined: Jan 16, 2002
Posts: 469
My Puropose:
While client is navigating different pages,whatever data he enters using servlet I will store in session. Finally when client done navigating pages, I want to get data from session object & want to create xml file to fill up this data & send this xml file to database.
P.S.: I don't want have XML template sitting on
server so I can fill up values. I want to create XML file on fly to fill up data using java object.
Thanks.
Angela
Originally posted by Balaji Loganathan:
I can't understand your exact requirement, any way this link may help you http://www.coderanch.com/t/125765/XML/Java-objects-XML-file-vice
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
For this you can use a simple file writer which read the sessions and create a xml file and give it to database.
In my view that could be the best option and speedy as well.
Ajith Kallambella
Sheriff

Joined: Mar 17, 2000
Posts: 5782
Originally posted by Angela D'souza:
... Finally when client done navigating pages, I want to get data from session object & want to create xml file to fill up this data & send this xml file to database.

I am just curious to know, exactly what sort of value addition is achieved by using XML here? Are you working with an XML-aware database that can transform the XML document into proper SQL constructs?


Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
Tina Desai
Ranch Hand

Joined: Mar 13, 2003
Posts: 365
Ajith,
Your post brings out a question in my mind.
When can xml make considerable value addition? When one should go for xml?
Tina


Alongwith being a good coder, try to be a good professional as well!
Ajith Kallambella
Sheriff

Joined: Mar 17, 2000
Posts: 5782
Here are some thoughts..
XML is not a silver bullet and I have seen many projects undergo unnecessary "XML-inclusion". Some of the best uses of XML include enterprise application integration and using XML as a distributed application protocol. That is where you get best bang for the buck.
XML is also a great technology for capturing configuration information. Because it is extensible, flexibility can be added (almost) on the fly. In fact, it is the extensibility that makes XML lot better than plain vanilla properties files. With XML you can now add a "structure" to previously non-hierarchical config information. And then ofcourse, there is the birth-reason ie., separate data from presentation to support dynamic content formats.
XML may not always be( and more than often it is not) a great inter-application solution. For instance, if you have an all Java system, you are better off making use of core Java language features for things such as remote method invocation, data representation, and packaging parameters or results( incidentally, all three happen to be potential areas for XML-ization) across subsystem boundaries. One has to realize using XMl does not come free and has its own overheads.
Rule of thumb( that I use) is this - if all systems talk the same language and you don't need to expose them to outer world, you probably don't need XML for transport. Even when you need to open up your systems to outer world, if you are only talking with trusted parterns, investigate other EAI options including good old CORBA and messaging.
Ajith Kallambella
Sheriff

Joined: Mar 17, 2000
Posts: 5782
Coming back to my original question to Angela, in the absence of any specialized database support for representing queries as XML documents, packaging DB calls as XML document is unnecessary and adds to the overhead.
I asked the question because it wasn't very clear in Angela's posts why XML is being considered in the first place.
Angela wrote

Finally when client done navigating pages, I want to get data from session object & want to create xml file to fill up this data & send this xml file to database.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: XML file on fly
 
Similar Threads
commons log doubt
Have the power to become invisible, to mind-read, or to fly?
XML over HTTP
Interaction of XML and XSD on the fly
generating dynamic xml with java