File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services and the fly likes Can we generate a XML from XSD using SAX Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Can we generate a XML from XSD using SAX" Watch "Can we generate a XML from XSD using SAX" New topic

Can we generate a XML from XSD using SAX

Bhavin Parekh

Joined: May 06, 2007
Posts: 1
Pls help me in exploring the SAX parser, and do tell me whether we can generate a XML file from a XML schema using SAX like we do using DOM and castor objects, or is SAX just used for the sole purpose of parsing
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13037
You can generate a stream of events that mimic the output of a SAX parser and use them to create XML documents.
I know of no way to automatically use XSD, that requires programming on your part to combine your data with the XSD structure information.

I did this article on "pipeline" processing of SAX events.
There are some tricky concepts here. Fortunately, Elliot Rusty Harold has placed this chapter from his big XML book online. Read that first.

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63866

"Bhavin B P",

There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

JavaRanch Sheriff

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: Can we generate a XML from XSD using SAX
It's not a secret anymore!