Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

XML file on fly

 
Angela D'souza
Ranch Hand
Posts: 469
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
How to create xml file on fly using java object.
Thanks,
Angela
 
Balaji Loganathan
author and deputy
Bartender
Posts: 3150
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Angela D'souza
Ranch Hand
Posts: 469
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3150
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5782
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Tina Desai
Ranch Hand
Posts: 365
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ajith,
Your post brings out a question in my mind.
When can xml make considerable value addition? When one should go for xml?
Tina
 
Ajith Kallambella
Sheriff
Posts: 5782
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5782
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic