You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by "Ali, Haneef" <ha...@hp.com> on 2005/02/12 01:57:21 UTC
Getting schemaType from QName
Hi,
<element name="SomeName" type="string"/>
You can get the schemaType by using the following code
SchemaType type = XmlBeans.getContextTypeLoader().findType(qn);
if (type == null)
type = XmlBeans.getContextTypeLoader( ).findDocumentType( qn );
But for the schema given below it returns null
<complexType name="SomeName" >
<element name="ChildName" type="string"/>
</complexType>
I'm not able to get the schemaType for "ChildName". How to get
it?
Haneef
-----Original Message-----
From: Aleksander Slominski [mailto:aslom@cs.indiana.edu]
Sent: Thursday, February 10, 2005 4:09 PM
To: user@xmlbeans.apache.org
Subject: Re: SchemaType from Qname
Ali, Haneef wrote:
>Hi,
>
>How to get SchemaType from Qname?
>
>
in XmlBeans V1 and it hink it is the same in V2) this should work
(assuming you have JAR files on CLASSPATH):
QName qn = new QName( "http://example.com/ns", "MyElement"
);
//SchemaType type =
XmlBeans.getContextTypeLoader().findType(qn);
SchemaType type = XmlBeans.getContextTypeLoader(
).findDocumentType( qn );
System.out.println( "Type=" + type );
and if you already jave particular SchemaTypeSystem that worked for me:
SchemaType type2 = schemaTypeSystem.findDocumentType( qn );
System.out.println( "Type2=" + type2 );
if ( type2 != null ) {
System.out.println( "Type2=" + type2.getFullJavaName( )
);
System.out.println( "Type2=" +
type2.getFullJavaImplName( ) );
}
SchemaGlobalElement globalElement =
schemaTypeSystem.findElement( qn );
HTH,
alek
--
The best way to predict the future is to invent it - Alan Kay
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org