varuag
varuag

Reputation: 11

Parsing XML Schemas and deriving metadata in Java

I have been looking at ways to parse XML Schema files for metadata of types defined in those files and get other information, and build the type hierarchy to be shown to the user.

I found a number of candidates:

  1. Apache WS Commons XMLSchema API
  2. Apache Xerces XML Schema API
  3. XSOM
  4. XMLBeans

XMLSchema API and Xerces XML Schema API seem the two best suited. While XMLSchema API was easier to use, it is not as well documented, and Xerces seems to be the one with much more support. However, I have been unable to locate any resources which might help me get started with the Xerces XML Schema API, except their FAQ's which have proved to be highly inadequate.

So my question is twofold - Which is the better choice for parsing and querying Schema files, and there any resources for these two to get started quickly?

Upvotes: 1

Views: 762

Answers (2)

Michael Kay
Michael Kay

Reputation: 163322

Another option you might consider is Saxon's SCM format, which is an XML representation of the schema component model. Both SCM and XSOM are closely based on the schema component model defined in the W3C specs, and rely heavily on the user understanding that model; they don't repeat the documentation of the component model in the API definitions.

Upvotes: 0

savionok
savionok

Reputation: 485

take a look at Xstream, it's a good instrument for serialization, but you also can use it for parsing. Here is two minute tutorial.

Upvotes: 2

Related Questions