This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi, I wanted to ask a very basic question. I have a java object and i want to serialize it as an xml file. How should i do it a) Create a new document using DOM and then serialize it using XSLT b) Create the xml file by simply writing data (along with the tags) to a file. Pls. suggest.
a) Create a new document using DOM and then serialize it using XSLT b) Create the xml file by simply writing data (along with the tags) to a file.
Following the simplest thing that could possibly work principle, I'd say b) is a better option. Especially when I don't quite see why you would need to use XSLT for serializing a DOM tree into disk as XML...?
use XSLT for serializing a DOM tree into disk as XML...?
With JAXP 1.1, this was the only way to serialize XML documents I guess. Not sure if JAXP1.2 has added a standard way of serializing XML documents though. On a side note I wonder if JAXP has been a huge success and if people have been doing XML processing on top of JAXP :roll: I beleive there are always situations when we are better off using processor specific features. Can anybody share their views?
Joined: Jan 23, 2002
With JAXP 1.1, this was the only way to serialize XML documents I guess.
Ok. I think you guys are talking aboutRight? I didn't consider that as being "XSLT" (which I associate to "having an .xsl file")...
Joined: Mar 06, 2001
Yes, i meant identity transformation only.
Joined: Apr 25, 2003
Thanks for your reply. Now i am convinced that DOM is a better option. On a little bit of research, I found there is another option available - JDom. What do you guys think about it - JDOM or DOM + XSLT.
Joined: Jan 23, 2002
I would probably stick to "DOM + XSLT" over JDom just to avoid adding yet-another third party library into the project but instead use a portable, standard piece of code.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com