Looks reasonable to me. You may want to also look at
XmlBeans.compileXsd(). The advantage of compileXsd() over loadXsd() is
that it allows you to then enumerate all the types that existed in the
Schema. But if know the name of the type, loadXsd() whould suffice and
it is easier to use. So your code is good.
Radu
On Sun, 2008-03-30 at 13:44 -0400, Paulo Silveira wrote:
> Hi All,
>
> I need to parse a XML Schema to get information about the types
> declared in it.
>
> I implemented as following:
>
> XmlObject xobj = XmlObject.Factory.parse(myXSDFile);
> SchemaTypeLoader schemaLoader = XmlBeans.loadXsd(new
> XmlObject[]{xobj});
>
> QName qname = new QName(myTypeName);
>
> SchemaType st = schemaLoader.findType(qname);
> st.getFacet(SchemaType.FACET_...);
>
> Is it a good way to implement it?
>
> I need to get facet restriction from a XML Schema in runtime.
>
> Thanks,
> Paulo
Notice: This email message, together with any attachments, may contain
information of BEA Systems, Inc., its subsidiaries and affiliated
entities, that may be confidential, proprietary, copyrighted and/or legally
privileged, and is intended solely for the use of the individual or entity
named in this message. If you are not the intended recipient, and have received
this message in error, please immediately return this by email and then delete
it.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]