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/11 00:59:30 UTC

SchemaType from Qname

Hi,

How to get SchemaType from Qname?

Regards,
Haneef

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org


Re: SchemaType from Qname

Posted by Aleksander Slominski <as...@cs.indiana.edu>.
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