• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Help !! Parsing Schema

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

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,

--------------------
 
Ranch Hand
Posts: 225
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I recommend castor. Castor allows you to specify a binding file to handle this type of requirement.
 
Priyank kumar Tiwari
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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..
 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also you can look at this API:

XSOM

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


Now,
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="http://www.w3.org/2001/XMLSchema">
<xsd:element name="note" type="NoteType"/>
<xsd:complexType name="NoteType">
<xsd:sequence>
<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"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>

And I want to print important elements:

Like:

Note
To
From
Heading
Body

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

Thanks in advance,

Gabriel
 
What are you doing in my house? Get 'em tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic