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 JAVA,XML ,WRiter Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "JAVA,XML ,WRiter" Watch "JAVA,XML ,WRiter" New topic
Author

JAVA,XML ,WRiter

sridhar
Greenhorn

Joined: May 05, 2001
Posts: 7
Dear masters,
I want to create an XML page in runtime using JAVA Document.please kindly help me
thank you
Mapraputa Is
Leverager of our synergies
Sheriff

Joined: Aug 26, 2000
Posts: 10065
Sridhar,
Zaeem Masood Ashar does exactly this in the next thread On Monday Ajith will solve all problems and until then you can just look at the code and try your version.
Also, your name doesn�t comply with our Official policy on registered names, unfortunately You are required to have a name of at least two words, separated by a space, and it�s great if they all are real.

Uncontrolled vocabularies
"I try my best to make *all* my posts nice, even when I feel upset" -- Philippe Maquet
Ajith Kallambella
Sheriff

Joined: Mar 17, 2000
Posts: 5782
Since an XML document is a plain ASCII-based text file, you have the following options -

    [list] Let your Java program create a String representation of the XML. Since many XML applications/parsers are capable of handling XML data either from a file or from a String stream, you shouldn't have any problems interpreting or using the XML String.
    Example -

    Whenever you want to convert your Object to an XML representation, you can simply call this method.
    [/list]
  • Let your Java program create an XML document ( for example, using the method as mentioned above, ) save it in a file and pass the client(s) a reference to this file. This approach would help you decouple the XML creation and consumption and can be a very good solution in situations where the client needs access to the XML beyond the lifetime of the server process.
  • Use the DOM approach - Using DocumentFragment, you can create a partial XML tree and pass the object to the client process. This approach has several drawbacks - at the least, the client should have access to a DOM parser, passing a DOM tree back and forth across a network will cause performance overheads. If the client decides to use a SAX parser OR would like the XML document to be available "offline" beyond the life of the server process, this approach is no good.
  • Sun is working on XML Databinding( JAXB ) infrastructure that will allow you to seamlessly persist an object( of any class type ) into an XML document and read such documents to create objects at runtime. Whenit matures, this facility will greatly enhance XML-ability of Java classes and will alleviate the burden of writing messy toXMLString() method for all your classes. Checkout the JSR on Sun's website.

  • Hope this gives you an idea about how to proceed.
    Cheers!

    [This message has been edited by Ajith Kallambella (edited May 07, 2001).]


Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JAVA,XML ,WRiter