aspose file tools*
The moose likes Java in General and the fly likes Parse XML Schema Document Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Parse XML Schema Document" Watch "Parse XML Schema Document" New topic
Author

Parse XML Schema Document

Jeff Storey
Ranch Hand

Joined: Apr 07, 2007
Posts: 230
Hi, is there a way to parse an XSD so I can iterate over the various elements in it? It may be a complex XSD that imports elements from other XSDs as well, and I'd like to be able to iterate over the child elements of the imported elements. Thanks!
Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2308
XSD is nothing but XML.You can do parsing the very same way we do for XML using XML parsers.


Rahul Bhattacharjee
LinkedIn - Blog
Jeff Storey
Ranch Hand

Joined: Apr 07, 2007
Posts: 230
Agreed, but what happens when my xsd document imports elements from another document? I want to be able to access the child elements of the imported element, not just the name of the imported element.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12821
    
    5
What happened when you tried it?

Bill
Jeff Storey
Ranch Hand

Joined: Apr 07, 2007
Posts: 230
It treats it just like a regular XML document as I expected. So, if I had the following snippet:



where c:address is the address type imported from another schema. I'd like to be able to get at the fields within address (say, line1, line2, city, state, zip). This seems like it could be some pretty tedious code to write, so I'm wondering if any libraries already do it, but I couldn't find any.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Parse XML Schema Document