File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Generate xml on fly

 
Aryan Khan
Ranch Hand
Posts: 290
Java Oracle Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13044
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic