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 Generate xml on fly 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 "Generate xml on fly" Watch "Generate xml on fly" New topic
Author

Generate xml on fly

Aryan Khan
Ranch Hand

Joined: Sep 12, 2004
Posts: 290

Hi all,

I have a method like :


In this method I would like to construct a xml message from the 3 parameters and they should be validated against xml schema and sent to some other application.

My question is, how can we generate xml on the fly from java variables and validate it as well.


Thanks
Ahmad


OCP/MCP/SCJP/SCWCD/IBM XML/SCMAD/SCEA-1
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12675
    
    5
I would do XML creation with plain print statements - no need to validate with a schema if you control the exact output in your own program and it will be much faster.

How to send the result? That depends on how the other application is listening.

Needless to say, there are many more complicated ways to do this - see for example the java.bean package XMLDecoder and XMLEncoder classes.

Bill


Java Resources at www.wbrogden.com
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Generate xml on fly
 
Similar Threads
Inhertiting complex type in XML Schema
specify root for xsd validation
Document/litereal or RPC/Literal
XML Schema to Java options
Reading xmlschema file