Hi Kris,

The interfaces in the XML Schema API [1] are isomorphic to the schema
components described by the schema specification. You'll have to walk
through a few particles (XSParticle) and a model group (XSModelGroup) to
get from the complex type definition (XSComplexTypeDefinition) to the local
element declarations (XSElementDeclaration) you're looking for.

xs.QueryXS is the only sample included with Xerces however there have been
lots of discussions on this mailing list on usage of the XML Schema API.
Have you searched the archive [2] for examples?

Thanks.

[1]
http://www.w3.org/Submission/2004/SUBM-xmlschema-api-20040309/xml-schema-api.html
[2] http://marc.info/?l=xerces-j-user&r=1&w=2

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: [EMAIL PROTECTED]
E-mail: [EMAIL PROTECTED]

Kris Wolff <[EMAIL PROTECTED]> wrote on 07/18/2008 08:47:11 AM:

> Hi list,
>
> i have a question, that might be a stupid one, but i can not figure out,
> if its even work with xerces-j or not.
> I have a xsd and i want to build a map like
>
> element -> (can have)  element              -> with attributes( foo, bar
)
>                                         or element         -> with
> attributes(foo)
>                                                                    ->
> (can have) element
>

> or element
>                                         or element
>
> and so on. Maybe a hashtable with the keys [attributes] ans [elements]
> for each element. That is not imortent, importnt is that i have to read
> the schema and store the informations about elements, attributes and
> types in a diffrent format inside the memory.
>
> I tried to play around with the xs.QueryXs example, but i only get the
> root element. I tried to read docu, goole, and so on, but i can't find
> any example how to dump all elements in the order the xsd descripes.
>
> For example, i have these code:
> XSModel model = schemaLoader.loadURI(argv[0]);
> XSNamedMap map = model.getComponents(XSConstants.ELEMENT_DECLARATION);
> if (map.getLength() != 0) {
>
System.out.println("*************************************************");
>     System.out.println("* Global element declarations: {namespace} name
");
>
System.out.println("*************************************************");
>     for (int i = 0; i < map.getLength(); i++) {
>          XSObject item = map.item(i);
>          System.out.println("{" + item.getNamespace() + "}" +
> item.getName());
>     }
> }
>
> witch shows me the right root element of a valid xml, descripes in the
> xsd. But how to get the next level. How can i get all elements that are
> allowd inside the root-element?
>
> can someone post me a example or point me into the right direction,
please.
>
>
> best regards,
> kris
>
> ---
> wdv Gesellschaft fuer Medien & Kommunikation mbH & Co. OHG,
> Bad Homburg v.d.H., AG. Bad Homburg HRA 3087
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>

Reply via email to