dev@fi.java.net

Re: Generation of external vocabularies

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Tue, 16 Aug 2005 12:22:13 -0700

Paul Sandoz wrote:
> Hi Kohsuke,
>
> Using XSOM how easy is it to get all element definitions and attribute
> definitions for a schema?

If it's just global element decls, that's very very easy.

   XSSchemaSet schemas = ...;
   schemas.iterateElementDecls();

If you really mean all element definitions including local ones, it
involves in traversing the schema, so you need to implement XSVisitor to
walk through the tree. But I can probably write one in 10 minutes.



> I want to try and generate an external vocabulary from a schema and set
> of sample documents. The sample documents will be used to generate
> indexes in proportion to the frequency of information specified in the
> schema.

Matching up elements and attributes in instance documents to schema
definitions are definitely harder, though.


-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com