This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes Help !! Parsing Schema Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Help !! Parsing Schema " Watch "Help !! Parsing Schema " New topic

Help !! Parsing Schema

Priyank kumar Tiwari

Joined: Aug 11, 2005
Posts: 4

My goal is to take an XML Schema, transform the schema into a DOM structure that I can Traverse .I am using Jdom ,and I am able to parse the schema ,but I am facing problem for the cases when my schema is including (or importing)some other xsd's .In those cases I am unable to get a handle to those complex elements present in external xsd.Please suggest some parser to do that .
Does anyone know of an API that will help me do this in Java??

Thanks in advance,

Andy Hahn
Ranch Hand

Joined: Aug 31, 2004
Posts: 225
I recommend castor. Castor allows you to specify a binding file to handle this type of requirement.
Priyank kumar Tiwari

Joined: Aug 11, 2005
Posts: 4
Hi Andy,

Thanks for the suggestion .I am looking into it .I have worked fairly a lot on SAX/DOM but didnt ever got a chance to work in castor,can you please recommend me some good tutorial or link where I can get all relevent details on Castor.I was going through some discussion forums ,and people are having some issues when the including schemas have enums or complex contents.So it would be very helpful if you (or anybody :-)Plzzz )can suggest a place where I can get good material on it ,

Thanks a lot for your reply..
Gabriel Buheler
Ranch Hand

Joined: Apr 21, 2004
Posts: 39
Also you can look at this API:


There it is few documentation, but I think that support included schemas.

Could you please help me with a schema parser?
Basically I need:

I want to parse a xsd file.

For example, �test.xsd� file:

<xsd:schema xmlns:xsd="">
<xsd:element name="note" type="NoteType"/>
<xsd:complexType name="NoteType">
<xsd:element name="to" type="xsd:string"/>
<xsd:element name="from" type="xsd:string"/>
<xsd:element name="heading" type="xsd:string"/>
<xsd:element name="body" type="xsd:string"/>

And I want to print important elements:



How can I do that? Could your provide me with an example?

Thanks in advance,

subject: Help !! Parsing Schema
It's not a secret anymore!