Hi Mukul,

The XSModel is just a container of SchemaGrammars. It's only going to have
what was put in the grammars; in your example just the one element
declaration and other components reachable to it by reference.

What you're looking for is this method [1]. It returns the complete XSModel
from the ElementPSVI (usually at the end of the validation root). The
schema validator fills that with all the SchemaGrammars that were pulled
into the grammar bucket in the course of validating the document.

ElementPSVI elemPSVI = (ElementPSVI)augs.getItem(Constants.ELEMENT_PSVI);
XSModel xsmodel = elemPSVI.getSchemaInformation();

Thanks.

[1]
http://xerces.apache.org/xerces2-j/javadocs/xs/org/apache/xerces/xs/ElementPSVI.html#getSchemaInformation()

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: [email protected]
E-mail: [email protected]

Mukul Gandhi <[email protected]> wrote on 05/12/2009 06:49:05 AM:

> Hi all,
>   Let there be an augmentations object, "Augmentations augs". augs is
> populated correctly.
>
> If I write the code below:
>
> ElementPSVI elemPSVI = (ElementPSVI)augs.getItem(Constants.ELEMENT_PSVI);
>
> SchemaGrammar schemaGrammar = new SchemaGrammar(null,null,null);
> schemaGrammar.addGlobalElementDecl((XSElementDecl)elemPSVI.
> getElementDeclaration());
> SchemaGrammar[] grammarList = { schemaGrammar };
>
> XSModel xsmodel = new XSModelImpl(grammarList);
>
> The element declaration, which is passed to the method,
> 'addGlobalElementDecl' above is the root element of the XML document.
>
> Would the above code result in a full Schema tree inside, xsmodel?
>
> Or, would xsmodel contain only the first level element declaration
> (and no sibling Schema information)?
>
> If, xsmodel would not contain the full Schema tree, how do I construct
> it given an Augmentations object?
>
> --
> Regards,
> Mukul Gandhi
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]

Reply via email to