File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes XML and Related Technologies and the fly likes Generating XML from java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Generating XML from java" Watch "Generating XML from java" New topic
Author

Generating XML from java

Maha Hassan
Ranch Hand

Joined: Aug 02, 2005
Posts: 133
Hi,

I am wondering if there is a way to generate the xml from java
i mean that after creating an element using this code

system.out.println(element);
i get <element>text of element</element>

or do i have to type them each time like
system.out.println("<"+element.getTag +">"+element.getTextNode()+"</");
etc,,

thanks
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12675
    
    5
If you have a Document object in memory you can use a Transformer to output it as a stream to a file or buffer in memory.
See these classes:
Maha Hassan
Ranch Hand

Joined: Aug 02, 2005
Posts: 133
thanks, that was very helpful

[ August 02, 2006: Message edited by: Maha Hassan ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Generating XML from java
 
Similar Threads
Getting XML Out of a org.w3c.dom.Document
XML element
Invalid XML error...Newbie question
DOM (xml) question
Can anyone help?I still can't append records in xml...