Hi Hubert,

XSModel is a model of the schema components [1] defined by the XML schema
specification. The XML representation of the schema is not part of this
model. If you want access to the namespace declarations I suggest you
process the schema document with one of the general purpose XML APIs (e.g.
SAX or DOM) and extract the namespace declarations from there.

Thanks.

[1] http://www.w3.org/TR/xmlschema-1/#components

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

"Hubert Felber" <[EMAIL PROTECTED]> wrote on 10/30/2008 05:25:56 PM:

> Hello,
>
> Please help me with something I got stuck:
> I want to get some information out ouf a schema and dont know howto
> do the following:
>
> How do I get the xmlns:po attribute (targetnamespace) out of the
> following schema
>
> <xs:schema
>    xmlns:xs="http://www.w3.org/2001/XMLSchema";
>    xmlns:po="http://openuri.org/easypo";
>    targetNamespace="http://openuri.org/easypo";
>    elementFormDefault="qualified">
> I figured out that I can retrieve some info with this:
>
> targetname space = xsModel.getComponents(XSConstants.
> TYPE_DEFINITION).item(0).getNamespace();
> NamespacesList =  xsModel.getNamespaces()
> but I cannot find how to get for example the "xmlns:po" attribute
> for qualified Element names.
>
> I want to create an xml and use this for createElementNS()
> Creating an XML works, but I need to put in the namespace info from
> the schema.
> Is this the correct way to extract namespace info out of a schema?
>
> Thank you
> Hubert

Reply via email to