QName to package

2006-03-22 Thread pat
Hi,

I need to convert QName to java package name. I've go through the
classes, but I cannot find some conversion method. Is there a such
method for conversion QName to java package ???

Thanks

Pat

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: QName to package

2006-03-22 Thread Cezar Andrei
Pat, 

I'm assuming you want to find out the java name for a corresponding to
the top level element name of a document, if that is the case first you
have to find the SchemaType describing that document type
XMLBeans.findDocumentType(QName topLevelElementName) (or
XMLBeans.findType(QName) if you have the qname of a type), and than call
sType.getJavaName() to find out the name of the interface.

Cezar

 -Original Message-
 From: pat [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, March 22, 2006 5:49 AM
 To: user@xmlbeans.apache.org
 Subject: QName to package
 
 Hi,
 
 I need to convert QName to java package name. I've go through the
 classes, but I cannot find some conversion method. Is there a such
 method for conversion QName to java package ???
 
 Thanks
 
   Pat
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]

___
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]



RE: ArrayStoreException in get*Array() method in custom Ant task

2006-03-22 Thread Tellis B. Ellis, IV



Forgot to mention that I am using substitution groups. 
Here's the complete XSD:

?xml version="1.0" 
encoding="UTF-8"?xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
targetNamespace="http://www.360commerce.com/internal/starteam/query/xml" 
xmlns="http://www.360commerce.com/internal/starteam/query/xml" 
elementFormDefault="qualified" 
attributeFormDefault="unqualified" 
 xs:complexType name="queryDefinition" 
abstract="true" 
 xs:sequence 
 
 
xs:element name="id" type="xs:ID" 
maxOccurs="1"/ 
/xs:sequence 
 /xs:complexType 
 xs:complexType name="itemQueryDefinition" 
abstract="true" 
xs:complexContent 
xs:extension 
base="queryDefinition" 
 
xs:sequence 
/xs:sequence 
/xs:extension 
/xs:complexContent 
/xs:complexType  
xs:complexType 
name="changeRequestQueryDefinition" 
xs:complexContent 
xs:extension 
base="itemQueryDefinition" 
 
xs:sequence 
/xs:sequence 
/xs:extension 
/xs:complexContent 
/xs:complexType  
xs:complexType 
name="fileQueryDefinition" 
xs:complexContent 
xs:extension 
base="itemQueryDefinition" 
 
xs:sequence 
 
/xs:sequence 
/xs:extension 
/xs:complexContent 
/xs:complexType  
xs:element name="query" type="queryDefinition"/ 
 xs:element name="item-query" 
type="itemQueryDefinition" substitutionGroup="query"/ 
 xs:element name="change-request-query" 
type="changeRequestQueryDefinition" 
substitutionGroup="item-query"/  
xs:element name="file-query" type="fileQueryDefinition" 
substitutionGroup="item-query"/  
xs:complexType 
name="queryDefinitionSet" 
 
xs:sequence 
xs:element ref="query" maxOccurs="unbounded" 
minOccurs="0"/ 
/xs:sequence 
 /xs:complexType 
 xs:element name="query-definition-set" 
type="queryDefinitionSet"/ 
/xs:schema

-- 
Tellis


From: Tellis B. Ellis, IV 
[mailto:[EMAIL PROTECTED] Sent: Wednesday, March 22, 2006 4:04 
PMTo: user@xmlbeans.apache.orgSubject: RE: 
ArrayStoreException in get*Array() method in custom Ant 
task

Thanks for the help Radu! I'll test out the resource load 
using the xmlbean's classloader and let you know how it works 
out.
What puzzles me somewhat is whyit (XMLBeans, the java 
classloader, etc) can't find the resource even if theresource is in the 
same jar as the 
xmlbean class file. Have you encountered anything similarin 
Ant or elsewhere? Also, how did you know the name of resource it expects 
is
"schemaorg_apache_xmlbeans/element/URI_SHA_1_1DD80F3162A834D56F4BECF11C9343A1641FECC5/item_2Dquery.xsb"?

Thanks,

-- 
Tellis


From: Radu Preotiuc-Pietro 
[mailto:[EMAIL PROTECTED] Sent: Wednesday, March 22, 2006 3:17 
PMTo: user@xmlbeans.apache.orgSubject: RE: 
ArrayStoreException in get*Array() method in custom Ant 
task

Yeah, it does smell like one of those esoteric 
classloader issues. Do you also use substitution groups in this context? (looks 
like there probably are global element definitionscorresponding to 
itenQueryDefinition, changeRequestQueryDefinition and 
fileQueryDefinition)

So what is happening is that XmlBeans doesn't have 
access to one of the generated resources so it can resolve the subst group. The 
resource name should be 
"schemaorg_apache_xmlbeans/element/URI_SHA_1_1DD80F3162A834D56F4BECF11C9343A1641FECC5/item_2Dquery.xsb" 
and the classloader should be com.commerce360.internal.cm.starteam.query.xml.QueryDefinitionSetXmlBean.class.getClassLoader() 
(hope I'm getting this right...). In order to debug this you can resource load 
that and see if ant makes it available to you, as a first 
step.

I'd appreciate it if you would let us know if get more 
info out of debugging this
Thanks,
Radu



From: Tellis B. Ellis, 
IV [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 21, 2006 
9:24 AMTo: user@xmlbeans.apache.orgSubject: RE: 
ArrayStoreException in get*Array() method in custom Ant 
task

Ileft out some of the stacktrace:

java.lang.ArrayStoreException
 at 
java.lang.System.arraycopy(Native 
Method) at 
java.util.ArrayList.toArray(ArrayList.java:305) 
at 
com.commerce360.internal.cm.starteam.query.xml.impl.QueryDefinitionSetXmlBeanImpl.getQueryArray(QueryDefinitionSetXmlBeanImpl.java:59)


Thanks,

-- 
Tellis



From: Tellis B. Ellis, IV 
[mailto:[EMAIL PROTECTED] Sent: Tuesday, March 21, 2006 11:01 
AMTo: user@xmlbeans.apache.orgSubject: ArrayStoreException 
in get*Array() method in custom Ant task

Fellow XMLBeans 
users,

I have an xmlbean 
andsome codethat uses the xmlbean. The code worksas 
expectedwhen launched from the java command-line
or launched via 
Ant's 'java' task. I wrote a simple Ant custom task to run the code. When the 
custom task is executedan ArrayStoreException is thrown in the bean's 
get*Array() method. I'm 
using XMLBeans 2.1.0 and Ant 1.6.4. Below is a snippet from the 
stacktrace:

 java.lang.ArrayStoreException
 at 
com.commerce360.internal.cm.starteam.query.xml.impl.QueryDefinitionSetXmlBeanImpl.getQueryArray(QueryDefinitionSetXmlBeanImpl.java:59)

The XSD fragment for 
the bean looks like this:

  xs:complexType 
  name="queryDefinitionSet" 
   
  xs:sequence 
  xs:element 

RE: ArrayStoreException in get*Array() method in custom Ant task

2006-03-22 Thread Tellis B. Ellis, IV



Radu,

I wrote some code to load the following resources from the 
xmlbeans-generated-jar:

schemaorg_apache_xmlbeans/type/URI_SHA_1_1DD80F3162A834D56F4BECF11C9343A1641FECC5/queryDefinition.xsbschemaorg_apache_xmlbeans/type/URI_SHA_1_1DD80F3162A834D56F4BECF11C9343A1641FECC5/itemQueryDefinition.xsbschemaorg_apache_xmlbeans/type/URI_SHA_1_1DD80F3162A834D56F4BECF11C9343A1641FECC5/changeRequestQueryDefinition.xsbschemaorg_apache_xmlbeans/type/URI_SHA_1_1DD80F3162A834D56F4BECF11C9343A1641FECC5/fileQueryDefinition.xsb

I was able to load all the resources when the code was 
executed from my Ant task.

Below is the code I used to test the resource 
loading:

 
 String[] 
res = 
{"schemaorg_apache_xmlbeans/type/URI_SHA_1_1DD80F3162A834D56F4BECF11C9343A1641FECC5/queryDefinition.xsb", 

"schemaorg_apache_xmlbeans/type/URI_SHA_1_1DD80F3162A834D56F4BECF11C9343A1641FECC5/itemQueryDefinition.xsb","schemaorg_apache_xmlbeans/type/URI_SHA_1_1DD80F3162A834D56F4BECF11C9343A1641FECC5/fileQueryDefinition.xsb","schemaorg_apache_xmlbeans/type/URI_SHA_1_1DD80F3162A834D56F4BECF11C9343A1641FECC5/changeRequestQueryDefinition.xsb" 
}; 
 for (int 
i = 0; i  res.length; 
i++) 
{ 
URL resUrl = 
QueryDefinitionSetXmlBean.class.getClassLoader().getResource(res[i]); 
if (resUrl == 
null) 
{ 
System.out.println("Failed to load resource " + 
res[i]); 
} 
else 
{ 
System.out.println("Loaded resource " + 
resUrl); 
} 
}

And the Ant output from my "starteam-query" custom 
task:

[starteam-query] Loaded resource 
jar:file:/U:/StarTeam/Working/internal/CM/StarTeam/dev/notification_server/bin/cm_notification_xmlbeans.jar!/schemaorg_apache_xmlbeans/type/URI_SHA_1_1DD80F3162A834D56F4BECF11C9343A1641FECC5/queryDefinition.xsb[starteam-query] 
Loaded resource 
jar:file:/U:/StarTeam/Working/internal/CM/StarTeam/dev/notification_server/bin/cm_notification_xmlbeans.jar!/schemaorg_apache_xmlbeans/type/URI_SHA_1_1DD80F3162A834D56F4BECF11C9343A1641FECC5/itemQueryDefinition.xsb[starteam-query] 
Loaded resource 
jar:file:/U:/StarTeam/Working/internal/CM/StarTeam/dev/notification_server/bin/cm_notification_xmlbeans.jar!/schemaorg_apache_xmlbeans/type/URI_SHA_1_1DD80F3162A834D56F4BECF11C9343A1641FECC5/fileQueryDefinition.xsb[starteam-query] 
Loaded resource 
jar:file:/U:/StarTeam/Working/internal/CM/StarTeam/dev/notification_server/bin/cm_notification_xmlbeans.jar!/schemaorg_apache_xmlbeans/type/URI_SHA_1_1DD80F3162A834D56F4BECF11C9343A1641FECC5/changeRequestQueryDefinition.xsb

-- 
Tellis




From: Tellis B. Ellis, IV 
[mailto:[EMAIL PROTECTED] Sent: Wednesday, March 22, 2006 4:25 
PMTo: user@xmlbeans.apache.orgSubject: RE: 
ArrayStoreException in get*Array() method in custom Ant 
task

Radu,

The names of the relevant .xsb resources for this XMLBean 
in the generated jarare:

schemaorg_apache_xmlbeans/type/URI_SHA_1_1DD80F3162A834D56F4BECF11C9343A1641FECC5/queryDefinition.xsbschemaorg_apache_xmlbeans/type/URI_SHA_1_1DD80F3162A834D56F4BECF11C9343A1641FECC5/itemQueryDefinition.xsbschemaorg_apache_xmlbeans/type/URI_SHA_1_1DD80F3162A834D56F4BECF11C9343A1641FECC5/changeRequestQueryDefinition.xsbschemaorg_apache_xmlbeans/type/URI_SHA_1_1DD80F3162A834D56F4BECF11C9343A1641FECC5/fileQueryDefinition.xsb

There is no resource named:

 
schemaorg_apache_xmlbeans/element/URI_SHA_1_1DD80F3162A834D56F4BECF11C9343A1641FECC5/item_2Dquery.xsb

Is this what you would expect?

Thanks,

-- Tellis


From: Tellis B. Ellis, IV 
[mailto:[EMAIL PROTECTED] Sent: Wednesday, March 22, 2006 4:04 
PMTo: user@xmlbeans.apache.orgSubject: RE: 
ArrayStoreException in get*Array() method in custom Ant 
task

Thanks for the help Radu! I'll test out the resource load 
using the xmlbean's classloader and let you know how it works 
out.
What puzzles me somewhat is whyit (XMLBeans, the java 
classloader, etc) can't find the resource even if theresource is in the 
same jar as the 
xmlbean class file. Have you encountered anything similarin 
Ant or elsewhere? Also, how did you know the name of resource it expects 
is
"schemaorg_apache_xmlbeans/element/URI_SHA_1_1DD80F3162A834D56F4BECF11C9343A1641FECC5/item_2Dquery.xsb"?

Thanks,

-- 
Tellis


From: Radu Preotiuc-Pietro 
[mailto:[EMAIL PROTECTED] Sent: Wednesday, March 22, 2006 3:17 
PMTo: user@xmlbeans.apache.orgSubject: RE: 
ArrayStoreException in get*Array() method in custom Ant 
task

Yeah, it does smell like one of those esoteric 
classloader issues. Do you also use substitution groups in this context? (looks 
like there probably are global element definitionscorresponding to 
itenQueryDefinition, changeRequestQueryDefinition and 
fileQueryDefinition)

So what is happening is that XmlBeans doesn't have 
access to one of the generated resources so it can resolve the subst group. The 
resource name should be 
"schemaorg_apache_xmlbeans/element/URI_SHA_1_1DD80F3162A834D56F4BECF11C9343A1641FECC5/item_2Dquery.xsb" 
and the classloader should be com.commerce360.internal.cm.starteam.query.xml.QueryDefinitionSetXmlBean.class.getClassLoader() 
(hope I'm