[prev in list] [next in list] [prev in thread] [next in thread]
List: xmlbeans-user
Subject: RE: Same element name but different complex type
From: "Radu Preotiuc-Pietro" <radup () bea ! com>
Date: 2008-06-13 0:13:46
Message-ID: BF6B6CA032BA0A429BD924F96765147DCC686B () repbex02 ! amer ! bea ! com
[Download RAW message or body]
I want to come back to this to clarify the case where one wants to parse
an existing XML file, rather than create a new one (and there are two
elements with the same name but mapped to different Java packages on the
classpath).
Using the context typeloader, one needs to do:
SchemaTypeLoader stl = XmlBeans.getContextTypeLoader();
XmlOptions o = new
XmlOptions().setDocumentType(com.mysite.XMLSchema.Apparel.ItemDataFeedDo
cument.type);
com.mysite.XMLSchema.Apparel.ItemDataFeedDocument newDoc1 =
(com.mysite.XMLSchema.Apparel.ItemDataFeedDocument)stl.parse(file, null,
o);
Alternatively one can use separate typeloaders like this:
SchemaTypeLoader appareltl =
com.mysite.XMLSchema.Apparel.ItemDataFeedDocument.type.getTypeSystem();
com.mysite.XMLSchema.Apparel.ItemDataFeedDocument newDoc1 =
(com.mysite.XMLSchema.Apparel.ItemDataFeedDocument)appareltl.parse(file,
null, null);
Radu
________________________________
From: Radu Preotiuc-Pietro [mailto:radup@bea.com]
Sent: Friday, April 25, 2008 5:43 PM
To: user@xmlbeans.apache.org; john.gan@worldofgoodinc.com
Subject: RE: Same element name but different complex type
Ok, got it. It says "some features might not work correctly".
But most will, so one can use that setup, it's just trickier.
Sure you can dynamically load the schemas at runtime, if that's
what you want. Of course, if you do that, then you won't be able to use
the generated classes. If you want to use generated classes, these
classes have to be loaded in a Java classloader, that's how Java works
(and the way to load them usually involves putting a jar file containing
the classes on the classpath). This is why I recommended that code.
If you don't know the Schemas until runtime, you can use
something like:
SchemaTypeSystem sts = XmlBeans.compileXsd(new XmlObject[] {
apparelSchema }, XmlBeans.getBuiltinTypeSystem(), null);
XmlObject newDoc1 = sts.newInstance(sts.findDocumentType(new
QName("http://www.mysite.com/XMLSchema", "ItemDataFeed")), null);
But at this point, you would need to use XmlCursor because there
are no generated classes that Java knows of, like I said.
Radu
________________________________
From: John Gan [mailto:john.gan@worldofgoodinc.com]
Sent: Friday, April 25, 2008 11:11 AM
To: user@xmlbeans.apache.org
Subject: RE: Same element name but different complex
type
Hi Radu,
Thanks for the reply. I have another question, I don't
suppose there is a way to dynamically load the schema at runtime from a
user and still be able to probe and execute methods that are unique to
the loaded schema? In other words, the schema is not known ahead of time
nor has a jar file in the build path. Basically apply my situation of
same namespace and element name to schemas that are not known ahead of
time. Does Java's "ClassLoader" (not XmlBean's "SchemaTypeLoader") have
something to do with it? I'm still a Java rookie and don't know much
about ClassLoaders. I just wanted to be pointed in the correct direction
if Java's "ClassLoader" is the solution or XmlBean's "SchemaTypeLoader"
is the solution.
Here is the link to the wiki that says to use class
loaders when changing the package names:
http://wiki.apache.org/xmlbeans/XmlBeansFaq#configPackageName
The last paragraph in this section says the following:
Note: XMLBeans doesn't support using two or more sets of
java classes (in different packages) mapped to schema types/elements
that have the same names and target namespaces, using all in the same
class loader. Depending on the direction you are using for the java
classes to schema types mapping, some features might not work correctly.
This is because even though the package names for the java classes are
different, the schema location for the schema metadata (.xsb files) is
the same and contains the corresponding implementing java class, so the
JVM will always pick up the first on the classpath. This can be avoided
if multiple class loaders are used.
Thanks again,
John
________________________________
From: Radu Preotiuc-Pietro [mailto:radup@bea.com]
Sent: Thursday, April 24, 2008 7:43 PM
To: user@xmlbeans.apache.org
Subject: RE: Same element name but different complex
type
John,
It's actually simpler than that. But first of all, let
me ask you where on the wiki have you found the bit with using multiple
typeloaders?
I am assuming that, since you have references to
com.mysite.XMLSchema.Apparel.ItemDataFeedDocument in your code, your
classpath contains both Apparel.jar and Books.jar. In this case just do
SchemaTypeLoader stl =
XmlBeans.getContextTypeLoader();
and you have a SchemaTypeLoader that has access to both
types' definitions.
But here's the main trick: the findDocumentType() method
expects the QName from the Schema as its argument (new
QName("http://www.mysite.com/XMLSchema", "ItemDataFeed")) but because
the target namespace is the same, this will not work (you will not be
able to get both types, for Apparel and for Book, but only the one that
is first on the classpath)! So instead, get the Schema type directly
from its associated class:
com.mysite.XMLSchema.Apparel.ItemDataFeedDocument newDoc1 =
(com.mysite.XMLSchema.Apparel.ItemDataFeedDocument)stl.newInstance(com.m
ysite.XMLSchema.Apparel.ItemDataFeedDocument.type, null);
This will work and, by replacing "Apparel" with "Book"
in the package names, you can create Book items too.
Hope this helps,
Radu
________________________________
From: John Gan
[mailto:john.gan@worldofgoodinc.com]
Sent: Tuesday, April 22, 2008 7:33 PM
To: user@xmlbeans.apache.org
Subject: Same element name but different complex
type
Hi,
I'm really new to xmlbeans and I have a
question. I have 2 xsd files which have pretty much the same element
names. The only difference is that they have some complex types which
have different elements inside them but have same global element name,
e.g.:
Books.xsd would have a complex type called
ItemProperties:
<xs:element minOccurs="0"
name="ItemProperties">
<xs:complexType>
<xs:sequence>
<xs:element
minOccurs="0" name="ISBN" nillable="true" type="xs:string" />
<xs:element
minOccurs="0" name="Author" nillable="true" type="xs:string" />
<xs:element
minOccurs="0" name="of-Pages" nillable="true" type="xs:string" />
<xs:element
minOccurs="0" name="Series-Vol." nillable="true" type="xs:string" />
<xs:element
minOccurs="0" name="Publisher" nillable="true" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
Apparel.xsd would also have a complex type call
ItemProperties:
<xs:element minOccurs="0"
name="ItemProperties">
<xs:complexType>
<xs:sequence>
<xs:element
minOccurs="0" name="Style" nillable="true" type="Style_Type" />
<xs:element
minOccurs="0" name="Womens-Sizes" nillable="true"
type="Womens-Sizes_Type" />
<xs:element
minOccurs="0" name="Sizes" nillable="true" type="Sizes_Type" />
<xs:element
minOccurs="0" name="Infant-Child-sizes" nillable="true"
type="Infant-Child-sizes_Type" />
<xs:element
minOccurs="0" name="Juniors-Sizes" nillable="true"
type="Juniors-Sizes_Type" />
</xs:sequence>
</xs:complexType>
</xs:element>
They both have the same namespace and I can't
change them because that is given to me:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema
xmlns="http://www.mysite.com/XMLSchema" elementFormDefault="qualified"
targetNamespace="http://www. mysite.com/XMLSchema"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
The wiki said to use multiple class loaders for
each jar to solve this issue of same namespace and element names. So I
compiled them into .jar with scomp individually since sfactor would give
me an error and I think the error is because there are complex types
with same name but different internal structure?
I found this sample code from the mailing list
back in 2005:
// get a SchemaTypeLoader from an array
of directories or jar
files
File[] schemaPath = null;
SchemaTypeLoader stl =
XmlBeans.typeLoaderForResource(XmlBeans.resourceLoaderForPath(schemaPath
));
// include the built-in type system
stl = XmlBeans.typeLoaderUnion(new
SchemaTypeLoader[]{XmlBeans.getBuiltinTypeSystem(), stl});
// parse the document in the given
a.b.c.RETURNDATADocument doc =
(a.b.c.RETURNDATADocument)stl.parse("xml", null,
null);
// or create a new one, given a
schemaType
SchemaType st = stl.findDocumentType(new
QName("a.b.c",
"RETURNDATA"));
a.b.c.RETURNDATADocument newDoc =
(a.b.c.RETURNDATADocument)stl.newInstance(st,
null);
I tried to compile each xsd with the following
xsdconfig file:
For books.xsd:
<xb:config
xmlns:xb="http://xml.apache.org/xmlbeans/2004/02/xbean/config">
<xb:namespace
uri="http://www.mysite.com/XMLSchema">
<xb:package>com.mysite.XMLSchema.Book</xb:package>
</xb:namespace>
</xb:config>
For apparel.xsd:
<xb:config
xmlns:xb="http://xml.apache.org/xmlbeans/2004/02/xbean/config">
<xb:namespace
uri="http://www.mysite.com/XMLSchema">
<xb:package>com.mysite.XMLSchema.Apparel</xb:package>
</xb:namespace>
</xb:config>
And this is my source code:
import java.io.File;
import javax.xml.namespace.QName;
import org.apache.xmlbeans.SchemaType;
import org.apache.xmlbeans.SchemaTypeLoader;
import org.apache.xmlbeans.XmlBeans;
import org.apache.xmlbeans.XmlException;
import
com.mysite.XMLSchema.Apparel.ItemDataFeedDocument;
public class Test {
/**
* @param args
* @throws XmlException
*/
public static void main(String[] args) {
File[] schemaPath = {new
File("Apparel.jar"), new File("Books.jar")};
SchemaTypeLoader stl =
XmlBeans.typeLoaderForResource(XmlBeans.resourceLoaderForPath(schemaPath
));
stl = XmlBeans.typeLoaderUnion(new
SchemaTypeLoader[]{XmlBeans.getBuiltinTypeSystem(), stl});
SchemaType st = stl.findDocumentType(new
QName("com.mysite.XMLSchema.Apparel", "ItemDataFeed"));
com.mysite.XMLSchema.Apparel.ItemDataFeedDocument newDoc1 =
(com.mysite.XMLSchema.Apparel.ItemDataFeedDocument)stl.newInstance(st,
null);
com.mysite.XMLSchema.Accessories.ItemDataFeedDocument newDoc2 =
(com.mysite.XMLSchema.Accessories.ItemDataFeedDocument)stl.newInstance(s
t, null);
com.mysite.XMLSchema.Apparel.ItemDataFeedDocument.ItemDataFeed apparel =
newDoc1.addNewItemDataFeed();
com.mysite.XMLSchema.Apparel.ItemDataFeedDocument.ItemDataFeed.Items
apparelItems = apparel.addNewItems();
com.mysite.XMLSchema.Apparel.ItemDataFeedDocument.ItemDataFeed.Items.Ite
m aItem = apparelItems.addNewItem();
com.mysite.XMLSchema.Apparel.ItemDataFeedDocument.ItemDataFeed.Items.Ite
m.ItemProperties itemProp = aItem.addNewItemProperties();
itemProp.setAge(com.mysite.XMLSchema.Apparel.AgeType.TEEN);
System.out.println(newDoc1.toString());
}
}
But SchemaType st would just return null? What
am I doing wrong and is there a better solution to the problem? I just
want to be able to create new instances of the xmlbean classes that have
the same namespace and element name (but different internal structures
for the complex types). Then set some values for the elements and write
to file.
Any help is greatly appreciated.
John
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.
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.
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.
[Attachment #3 (text/html)]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns="http://www.w3.org/TR/REC-html40" xmlns:v =
"urn:schemas-microsoft-com:vml" xmlns:o =
"urn:schemas-microsoft-com:office:office" xmlns:w =
"urn:schemas-microsoft-com:office:word"><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.3314" name=GENERATOR><!--[if !mso]>
<STYLE>v\:* {
BEHAVIOR: url(#default#VML)
}
o\:* {
BEHAVIOR: url(#default#VML)
}
w\:* {
BEHAVIOR: url(#default#VML)
}
.shape {
BEHAVIOR: url(#default#VML)
}
</STYLE>
<![endif]-->
<STYLE>@font-face {
font-family: Tahoma;
}
@page Section1 {size: 8.5in 11.0in; margin: 1.0in 1.25in 1.0in 1.25in; }
P.MsoNormal {
FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman"
}
LI.MsoNormal {
FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman"
}
DIV.MsoNormal {
FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman"
}
A:link {
COLOR: blue; TEXT-DECORATION: underline
}
SPAN.MsoHyperlink {
COLOR: blue; TEXT-DECORATION: underline
}
A:visited {
COLOR: purple; TEXT-DECORATION: underline
}
SPAN.MsoHyperlinkFollowed {
COLOR: purple; TEXT-DECORATION: underline
}
PRE {
FONT-SIZE: 10pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Courier New"
}
SPAN.EmailStyle18 {
COLOR: windowtext; FONT-FAMILY: Arial; mso-style-type: personal
}
SPAN.EmailStyle19 {
COLOR: navy; FONT-FAMILY: Arial; mso-style-type: personal-reply
}
DIV.Section1 {
page: Section1
}
</STYLE>
</HEAD>
<BODY lang=EN-US vLink=purple link=blue>
<DIV dir=ltr align=left><SPAN class=593360400-13062008><FONT face=Arial
color=#0000ff size=2>I want to come back to this to clarify the case where one
wants to parse an existing XML file, rather than create a new one (and there are
two elements with the same name but mapped to different Java packages on the
classpath).</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=593360400-13062008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=593360400-13062008><FONT face=Arial
color=#0000ff size=2>Using the context typeloader, one needs to
do:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=593360400-13062008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=593360400-13062008><FONT face=Arial
color=#0000ff size=2>SchemaTypeLoader stl =
XmlBeans.getContextTypeLoader();</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=593360400-13062008><FONT face=Arial
color=#0000ff size=2>XmlOptions o = new
XmlOptions().setDocumentType(com.mysite.XMLSchema.Apparel.ItemDataFeedDocument.type);</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=593360400-13062008><FONT face=Arial
color=#0000ff size=2>com.mysite.XMLSchema.Apparel.ItemDataFeedDocument newDoc1 =
(com.mysite.XMLSchema.Apparel.ItemDataFeedDocument)stl.parse(file, null,
o);</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=593360400-13062008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=593360400-13062008><FONT face=Arial
color=#0000ff size=2>Alternatively one can use separate typeloaders like
this:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=593360400-13062008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=593360400-13062008><FONT face=Arial
color=#0000ff size=2>SchemaTypeLoader appareltl =
com.mysite.XMLSchema.Apparel.ItemDataFeedDocument.type.getTypeSystem();</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=593360400-13062008><FONT face=Arial
color=#0000ff size=2><SPAN class=593360400-13062008><FONT face=Arial
color=#0000ff size=2>com.mysite.XMLSchema.Apparel.ItemDataFeedDocument newDoc1 =
(com.mysite.XMLSchema.Apparel.ItemDataFeedDocument)appareltl.parse(file, null,
null);</FONT></SPAN></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=593360400-13062008><FONT face=Arial
color=#0000ff size=2><SPAN
class=593360400-13062008></SPAN></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=593360400-13062008><FONT face=Arial
color=#0000ff size=2><SPAN
class=593360400-13062008>Radu</SPAN></FONT></SPAN></DIV><BR>
<BLOCKQUOTE
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; \
MARGIN-RIGHT: 0px"> <DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> Radu Preotiuc-Pietro
[mailto:radup@bea.com] <BR><B>Sent:</B> Friday, April 25, 2008 5:43
PM<BR><B>To:</B> user@xmlbeans.apache.org;
john.gan@worldofgoodinc.com<BR><B>Subject:</B> RE: Same element name but
different complex type<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV dir=ltr align=left><SPAN class=265004222-25042008><FONT face=Arial
color=#0000ff size=2>Ok, got it. It says "some features might not work
correctly". But most will, so one can use that setup, it's just
trickier.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=265004222-25042008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=265004222-25042008><FONT face=Arial
color=#0000ff size=2>Sure you can dynamically load the schemas at
runtime, if that's what you want. Of course, if you do that, then you won't be
able to use the generated classes. If you want to use generated classes, these
classes have to be loaded in a Java classloader, that's how Java works (and
the way to load them usually involves putting a jar file containing the
classes on the classpath). This is why I recommended that
code.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=265004222-25042008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=265004222-25042008><FONT face=Arial
color=#0000ff size=2>If you don't know the Schemas until runtime, you can use
something like:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=265004222-25042008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=265004222-25042008><FONT face=Arial
color=#0000ff size=2>SchemaTypeSystem sts = XmlBeans.compileXsd(new
XmlObject[] { apparelSchema }, XmlBeans.getBuiltinTypeSystem(),
null);</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=265004222-25042008><FONT face=Arial
color=#0000ff size=2>XmlObject newDoc1 =
sts.newInstance(sts.findDocumentType(new
QName("http://www.mysite.com/XMLSchema", "ItemDataFeed")),
null);</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=265004222-25042008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=265004222-25042008><FONT face=Arial
color=#0000ff size=2>But at this point, you would need to use XmlCursor
because there are no generated classes that Java knows of, like I
said.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=265004222-25042008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=265004222-25042008><FONT face=Arial
color=#0000ff size=2>Radu</FONT></SPAN></DIV><BR>
<BLOCKQUOTE
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; \
MARGIN-RIGHT: 0px"> <DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> John Gan
[mailto:john.gan@worldofgoodinc.com] <BR><B>Sent:</B> Friday, April 25, 2008
11:11 AM<BR><B>To:</B> user@xmlbeans.apache.org<BR><B>Subject:</B> RE: Same
element name but different complex type<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV class=Section1>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Hi
Radu,<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: \
Arial"><o:p> </o:p></SPAN></FONT></P> <P class=MsoNormal><FONT face=Arial \
color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: \
Arial">Thanks for the reply. I have another question, I don’t suppose \
there is a way to dynamically load the schema at runtime from a user and still be \
able to probe and execute methods that are unique to the loaded schema? In other
words, the schema is not known ahead of time nor has a jar file in the build
path. Basically apply my situation of same namespace and element name to
schemas that are not known ahead of time. Does Java’s \
“ClassLoader” (not XmlBean’s “SchemaTypeLoader”) have \
something to do with it? I’m still a Java rookie and don’t know much \
about ClassLoaders. I just wanted to be pointed in the correct direction if \
Java’s “ClassLoader” is the solution or XmlBean’s \
“SchemaTypeLoader” is the solution.<o:p></o:p></SPAN></FONT></P> <P \
class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; \
COLOR: navy; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P> <P \
class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; \
COLOR: navy; FONT-FAMILY: Arial">Here is the link to the wiki that says to use \
class loaders when changing the package names:<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: \
Arial"><o:p> </o:p></SPAN></FONT></P> <P class=MsoNormal><FONT face=Arial \
color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><A \
href="http://wiki.apache.org/xmlbeans/XmlBeansFaq#configPackageName">http://wiki.apache.org/xmlbeans/XmlBeansFaq#configPackageName</A><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: \
Arial"><o:p> </o:p></SPAN></FONT></P> <P class=MsoNormal><FONT face=Arial \
color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: \
Arial">The last paragraph in this section says the \
following:<o:p></o:p></SPAN></FONT></P> <P class=MsoNormal><FONT face=Arial \
color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: \
Arial"><o:p> </o:p></SPAN></FONT></P> <P class=MsoNormal><FONT face="Times New \
Roman" size=3><SPAN style="FONT-SIZE: 12pt">Note: XMLBeans doesn’t support \
using two or more sets of java classes (in different packages) mapped to schema \
types/elements that have the same names and target namespaces, using all in the \
same class loader. Depending on the direction you are using for the java classes to \
schema types mapping, some features might not work correctly. This is
because even though the package names for the java classes are different,
the schema location for the schema metadata (.xsb files) is the same and
contains the corresponding implementing java class, so the JVM will always
pick up the first on the classpath. This can be avoided if multiple class
loaders are used.<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Thanks
again,<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: \
Arial">John<o:p></o:p></SPAN></FONT></P> <P class=MsoNormal><FONT face=Arial \
color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: \
Arial"><o:p> </o:p></SPAN></FONT></P> <DIV>
<DIV class=MsoNormal style="TEXT-ALIGN: center" align=center><FONT
face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">
<HR tabIndex=-1 align=center width="100%" SIZE=2>
</SPAN></FONT></DIV>
<P class=MsoNormal><B><FONT face=Tahoma size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: \
Tahoma">From:</SPAN></FONT></B><FONT face=Tahoma size=2><SPAN style="FONT-SIZE: \
10pt; FONT-FAMILY: Tahoma"> Radu Preotiuc-Pietro [mailto:radup@bea.com] \
<BR><B><SPAN style="FONT-WEIGHT: bold">Sent:</SPAN></B> Thursday, April 24, 2008 \
7:43 PM<BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B>
user@xmlbeans.apache.org<BR><B><SPAN
style="FONT-WEIGHT: bold">Subject:</SPAN></B> RE: Same element name but
different complex type</SPAN></FONT><o:p></o:p></P></DIV>
<P class=MsoNormal><FONT face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: \
Arial">John,</SPAN></FONT><o:p></o:p></P> <P class=MsoNormal><FONT face="Times New \
Roman" size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">It's actually
simpler than that. But first of all, let me ask you where on the wiki have
you found the bit with using multiple
typeloaders?</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal><FONT face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">I am assuming that,
since you have references to
com.mysite.XMLSchema.Apparel.ItemDataFeedDocument in your code, your
classpath contains both Apparel.jar and Books.jar. In this case just
do</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal><FONT face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: \
Arial"> SchemaTypeLoader stl =
XmlBeans.getContextTypeLoader();</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal><FONT face=Arial color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">and you have a
SchemaTypeLoader that has access to both types'
definitions.</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal><FONT face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">But here's the main
trick: the findDocumentType() method expects the QName from the Schema as
its argument (new QName("http://www.mysite.com/XMLSchema", "ItemDataFeed"))
but because the target namespace is the same, this will not work (you will
not be able to get both types, for Apparel and for Book, but only the one
that is first on the classpath)! So instead, get the Schema type directly
from its associated class:</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal><FONT face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: \
Arial"> \
com.mysite.XMLSchema.Apparel.ItemDataFeedDocument newDoc1 = \
(com.mysite.XMLSchema.Apparel.ItemDataFeedDocument)stl.newInstance(com.mysite.XMLSchema.Apparel.ItemDataFeedDocument.type, \
null);</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal><FONT face=Arial color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">This will work and,
by replacing "Apparel" with "Book" in the package names, you can create Book
items too.</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal><FONT face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">Hope this
helps,</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal><FONT face=Arial color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: \
Arial">Radu<o:p></o:p></SPAN></FONT></P> <BLOCKQUOTE
style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; \
PADDING-LEFT: 3pt; PADDING-BOTTOM: 0in; MARGIN: 5pt 0in 5pt 3.4pt; BORDER-LEFT: blue \
1.5pt solid; PADDING-TOP: 0in; BORDER-BOTTOM: medium none"> <P class=MsoNormal><FONT \
face="Times New Roman" size=3><SPAN style="FONT-SIZE: \
12pt"><o:p> </o:p></SPAN></FONT></P> <DIV class=MsoNormal style="TEXT-ALIGN: \
center" align=center><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: \
12pt"> <HR tabIndex=-1 align=center width="100%" SIZE=2>
</SPAN></FONT></DIV>
<P class=MsoNormal style="MARGIN-BOTTOM: 12pt"><B><FONT face=Tahoma
size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: \
Tahoma">From:</SPAN></FONT></B><FONT
face=Tahoma size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">
John Gan [mailto:john.gan@worldofgoodinc.com] <BR><B><SPAN
style="FONT-WEIGHT: bold">Sent:</SPAN></B> Tuesday, April 22, 2008 7:33
PM<BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B>
user@xmlbeans.apache.org<BR><B><SPAN
style="FONT-WEIGHT: bold">Subject:</SPAN></B> Same element name but
different complex type</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Hi,<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">I’m really new to xmlbeans \
and
I have a question. I have 2 xsd files which have pretty much the same
element names. The only difference is that they have some complex types
which have different elements inside them but have same global element
name, e.g.:<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Books.xsd would have a complex
type called ItemProperties:<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: \
Arial"> \
<xs:element minOccurs="0"
name="ItemProperties"><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: \
Arial"> \
<xs:complexType><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: \
Arial"> \
<xs:sequence><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: \
Arial"> \
<xs:element minOccurs="0" name="ISBN" nillable="true" type="xs:string"
/><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: \
Arial"> \
<xs:element minOccurs="0" name="Author" nillable="true"
type="xs:string" /><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: \
Arial"> \
<xs:element minOccurs="0" name="of-Pages" nillable="true"
type="xs:string" /><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: \
Arial"> \
<xs:element minOccurs="0" name="Series-Vol." nillable="true"
type="xs:string" /><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: \
Arial"> \
<xs:element minOccurs="0" name="Publisher" nillable="true"
type="xs:string" /><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: \
Arial"> \
</xs:sequence><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: \
Arial"> \
</xs:complexType><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: \
Arial"> \
</xs:element><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Apparel.xsd would also have a
complex type call ItemProperties:<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: \
Arial"> \
<xs:element minOccurs="0"
name="ItemProperties"><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: \
Arial"> \
<xs:complexType><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: \
Arial"> \
<xs:sequence><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: \
Arial"> \
<xs:element minOccurs="0" name="Style" nillable="true"
type="Style_Type" /><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">
<xs:element \
minOccurs="0" name="Womens-Sizes" nillable="true" type="Womens-Sizes_Type"
/><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: \
Arial"> \
<xs:element minOccurs="0" name="Sizes" nillable="true"
type="Sizes_Type" /><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: \
Arial"> \
<xs:element minOccurs="0" name="Infant-Child-sizes" nillable="true"
type="Infant-Child-sizes_Type" /><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: \
Arial"> \
<xs:element minOccurs="0" name="Juniors-Sizes" nillable="true"
type="Juniors-Sizes_Type" /><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: \
Arial"> \
</xs:sequence><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: \
Arial"> \
</xs:complexType><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: \
Arial"> \
</xs:element><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">They both have the same
namespace and I can’t change them because that is given to
me:<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><?xml version="1.0"
encoding="utf-8"?><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><xs:schema
xmlns="http://www.mysite.com/XMLSchema" elementFormDefault="qualified"
targetNamespace="http://www. mysite.com/XMLSchema"
xmlns:xs="http://www.w3.org/2001/XMLSchema"><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">The wiki said to use multiple
class loaders for each jar to solve this issue of same namespace and
element names. So I compiled them into .jar with scomp individually since
sfactor would give me an error and I think the error is because there are
complex types with same name but different internal structure?
<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">I found this sample code from
the mailing list back in 2005:<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: \
Arial"><o:p> </o:p></SPAN></FONT></P><PRE><FONT face="Courier New" size=2><SPAN \
style="FONT-SIZE: 10pt"> // get a \
SchemaTypeLoader from an array of directories or \
jar<o:p></o:p></SPAN></FONT></PRE><PRE><FONT face="Courier New" size=2><SPAN \
style="FONT-SIZE: 10pt">files<o:p></o:p></SPAN></FONT></PRE><PRE><FONT face="Courier \
New" size=2><SPAN style="FONT-SIZE: \
10pt"><o:p> </o:p></SPAN></FONT></PRE><PRE><FONT face="Courier New" size=2><SPAN \
style="FONT-SIZE: 10pt"> File[] schemaPath \
= null;<o:p></o:p></SPAN></FONT></PRE><PRE><FONT face="Courier New" size=2><SPAN \
style="FONT-SIZE: 10pt"><o:p> </o:p></SPAN></FONT></PRE><PRE><FONT face="Courier \
New" size=2><SPAN style="FONT-SIZE: 10pt"> \
SchemaTypeLoader stl =<o:p></o:p></SPAN></FONT></PRE><PRE><FONT face="Courier New" \
size=2><SPAN style="FONT-SIZE: \
10pt">XmlBeans.typeLoaderForResource(XmlBeans.resourceLoaderForPath(schemaPath<o:p></o:p></SPAN></FONT></PRE><PRE><FONT \
face="Courier New" size=2><SPAN style="FONT-SIZE: \
10pt">));<o:p></o:p></SPAN></FONT></PRE><PRE><FONT face="Courier New" size=2><SPAN \
style="FONT-SIZE: 10pt"><o:p> </o:p></SPAN></FONT></PRE><PRE><FONT face="Courier \
New" size=2><SPAN style="FONT-SIZE: 10pt"> <o:p></o:p></SPAN></FONT></PRE><PRE><FONT \
face="Courier New" size=2><SPAN style="FONT-SIZE: \
10pt"><o:p> </o:p></SPAN></FONT></PRE><PRE><FONT face="Courier New" size=2><SPAN \
style="FONT-SIZE: 10pt"> // include the \
built-in type system<o:p></o:p></SPAN></FONT></PRE><PRE><FONT face="Courier New" \
size=2><SPAN style="FONT-SIZE: 10pt"><o:p> </o:p></SPAN></FONT></PRE><PRE><FONT \
face="Courier New" size=2><SPAN style="FONT-SIZE: \
10pt"> stl = \
XmlBeans.typeLoaderUnion(new<o:p></o:p></SPAN></FONT></PRE><PRE><FONT face="Courier \
New" size=2><SPAN style="FONT-SIZE: \
10pt">SchemaTypeLoader[]{XmlBeans.getBuiltinTypeSystem(), \
stl});<o:p></o:p></SPAN></FONT></PRE><PRE><FONT face="Courier New" size=2><SPAN \
style="FONT-SIZE: 10pt"><o:p> </o:p></SPAN></FONT></PRE><PRE><FONT face="Courier \
New" size=2><SPAN style="FONT-SIZE: 10pt"> <o:p></o:p></SPAN></FONT></PRE><PRE><FONT \
face="Courier New" size=2><SPAN style="FONT-SIZE: \
10pt"><o:p> </o:p></SPAN></FONT></PRE><PRE><FONT face="Courier New" size=2><SPAN \
style="FONT-SIZE: 10pt"> // parse the \
document in the given <o:p></o:p></SPAN></FONT></PRE><PRE><FONT face="Courier New" \
size=2><SPAN style="FONT-SIZE: 10pt"><o:p> </o:p></SPAN></FONT></PRE><PRE><FONT \
face="Courier New" size=2><SPAN style="FONT-SIZE: \
10pt"> a.b.c.RETURNDATADocument doc \
=<o:p></o:p></SPAN></FONT></PRE><PRE><FONT face="Courier New" size=2><SPAN \
style="FONT-SIZE: 10pt">(a.b.c.RETURNDATADocument)stl.parse("xml", null, \
null);<o:p></o:p></SPAN></FONT></PRE><PRE><FONT face="Courier New" size=2><SPAN \
style="FONT-SIZE: 10pt"><o:p> </o:p></SPAN></FONT></PRE><PRE><FONT face="Courier \
New" size=2><SPAN style="FONT-SIZE: 10pt"> <o:p></o:p></SPAN></FONT></PRE><PRE><FONT \
face="Courier New" size=2><SPAN style="FONT-SIZE: \
10pt"><o:p> </o:p></SPAN></FONT></PRE><PRE><FONT face="Courier New" size=2><SPAN \
style="FONT-SIZE: 10pt"> // or create a new \
one, given a schemaType<o:p></o:p></SPAN></FONT></PRE><PRE><FONT face="Courier New" \
size=2><SPAN style="FONT-SIZE: 10pt"><o:p> </o:p></SPAN></FONT></PRE><PRE><FONT \
face="Courier New" size=2><SPAN style="FONT-SIZE: \
10pt"> SchemaType st = \
stl.findDocumentType(new QName("a.b.c",<o:p></o:p></SPAN></FONT></PRE><PRE><FONT \
face="Courier New" size=2><SPAN style="FONT-SIZE: \
10pt">"RETURNDATA"));<o:p></o:p></SPAN></FONT></PRE><PRE><FONT face="Courier New" \
size=2><SPAN style="FONT-SIZE: 10pt"><o:p> </o:p></SPAN></FONT></PRE><PRE><FONT \
face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt"> \
a.b.c.RETURNDATADocument newDoc \
=<o:p></o:p></SPAN></FONT></PRE><PRE><FONT face="Courier New" size=2><SPAN \
style="FONT-SIZE: 10pt">(a.b.c.RETURNDATADocument)stl.newInstance(st, \
null);<o:p></o:p></SPAN></FONT></PRE> <P class=MsoNormal><FONT face=Arial \
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">I tried to compile each xsd
with the following xsdconfig file:<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">For
books.xsd:<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><xb:config
xmlns:xb="http://xml.apache.org/xmlbeans/2004/02/xbean/config"><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"> <xb:namespace
uri="http://www.mysite.com/XMLSchema"><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">
<xb:package>com.mysite.XMLSchema.Book</xb:package><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">
</xb:namespace><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: \
Arial"></xb:config><o:p></o:p></SPAN></FONT></P> <P class=MsoNormal><FONT \
face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">For
apparel.xsd:<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><xb:config
xmlns:xb="http://xml.apache.org/xmlbeans/2004/02/xbean/config"><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"> <xb:namespace
uri="http://www.mysite.com/XMLSchema"><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">
<xb:package>com.mysite.XMLSchema.Apparel</xb:package><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">
</xb:namespace><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: \
Arial"></xb:config><o:p></o:p></SPAN></FONT></P> <P class=MsoNormal><FONT \
face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">And this is my source
code:<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><B><FONT face="Courier New" color=#7f0055 size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; COLOR: #7f0055; FONT-FAMILY: \
'Courier New'">import</SPAN></FONT></B><FONT face="Courier New" color=black \
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">
java.io.File;</SPAN></FONT><FONT face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier \
New'"><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><B><FONT face="Courier New" color=#7f0055 size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; COLOR: #7f0055; FONT-FAMILY: \
'Courier New'">import</SPAN></FONT></B><FONT face="Courier New" color=black \
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">
javax.xml.namespace.QName;</SPAN></FONT><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier \
New'"><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><B><FONT face="Courier New" color=#7f0055 size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; COLOR: #7f0055; FONT-FAMILY: \
'Courier New'">import</SPAN></FONT></B><FONT face="Courier New" color=black \
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">
org.apache.xmlbeans.SchemaType;</SPAN></FONT><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier \
New'"><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><B><FONT face="Courier New" color=#7f0055 size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; COLOR: #7f0055; FONT-FAMILY: \
'Courier New'">import</SPAN></FONT></B><FONT face="Courier New" color=black \
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">
org.apache.xmlbeans.SchemaTypeLoader;</SPAN></FONT><FONT
face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier \
New'"><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><B><FONT face="Courier New" color=#7f0055 size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; COLOR: #7f0055; FONT-FAMILY: \
'Courier New'">import</SPAN></FONT></B><FONT face="Courier New" color=black \
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">
org.apache.xmlbeans.XmlBeans;</SPAN></FONT><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier \
New'"><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><B><FONT face="Courier New" color=#7f0055 size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; COLOR: #7f0055; FONT-FAMILY: \
'Courier New'">import</SPAN></FONT></B><FONT face="Courier New" color=black \
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">
org.apache.xmlbeans.XmlException;</SPAN></FONT><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier \
New'"><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><B><FONT face="Courier New" color=#7f0055 size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; COLOR: #7f0055; FONT-FAMILY: \
'Courier New'">import</SPAN></FONT></B><FONT face="Courier New" color=black \
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">
com.mysite.XMLSchema.Apparel.ItemDataFeedDocument;</SPAN></FONT><FONT
face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier \
New'"><o:p></o:p></SPAN></FONT></P> <P class=MsoNormal><FONT face="Courier New" \
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier \
New'"><o:p> </o:p></SPAN></FONT></P> <P class=MsoNormal><FONT face="Courier \
New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier \
New'"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><B><FONT face="Courier New" color=#7f0055 size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; COLOR: #7f0055; FONT-FAMILY: \
'Courier New'">public</SPAN></FONT></B><FONT face="Courier New" color=black \
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">
</SPAN></FONT><B><FONT face="Courier New" color=#7f0055 size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; COLOR: #7f0055; FONT-FAMILY: \
'Courier New'">class</SPAN></FONT></B><FONT face="Courier New" color=black \
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'"> Test
{</SPAN></FONT><FONT face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier \
New'"><o:p></o:p></SPAN></FONT></P> <P class=MsoNormal><FONT face="Courier New" \
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier \
New'"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier \
New'"> </SPAN></FONT><FONT face="Courier New" \
color=#3f5fbf size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: #3f5fbf; FONT-FAMILY: 'Courier \
New'">/**</SPAN></FONT><FONT face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier \
New'"><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier \
New'">
</SPAN></FONT><FONT face="Courier New" color=#3f5fbf size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: #3f5fbf; FONT-FAMILY: 'Courier \
New'">*</SPAN></FONT><FONT face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">
</SPAN></FONT><B><FONT face="Courier New" color=#7f9fbf size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; COLOR: #7f9fbf; FONT-FAMILY: \
'Courier New'">@param</SPAN></FONT></B><FONT face="Courier New" color=black \
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">
</SPAN></FONT><FONT face="Courier New" color=#3f5fbf size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: #3f5fbf; FONT-FAMILY: 'Courier \
New'">args</SPAN></FONT><FONT face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier \
New'"><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier \
New'">
</SPAN></FONT><FONT face="Courier New" color=#3f5fbf size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: #3f5fbf; FONT-FAMILY: 'Courier \
New'">*</SPAN></FONT><FONT face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">
</SPAN></FONT><B><FONT face="Courier New" color=#7f9fbf size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; COLOR: #7f9fbf; FONT-FAMILY: \
'Courier New'">@throws</SPAN></FONT></B><FONT face="Courier New" color=black \
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">
</SPAN></FONT><FONT face="Courier New" color=#3f5fbf size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: #3f5fbf; FONT-FAMILY: 'Courier \
New'">XmlException</SPAN></FONT><FONT face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">
</SPAN></FONT><FONT face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier \
New'"><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier \
New'">
</SPAN></FONT><FONT face="Courier New" color=#3f5fbf size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: #3f5fbf; FONT-FAMILY: 'Courier \
New'">*/</SPAN></FONT><FONT face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier \
New'"><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier \
New'">
</SPAN></FONT><B><FONT face="Courier New" color=#7f0055 size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; COLOR: #7f0055; FONT-FAMILY: \
'Courier New'">public</SPAN></FONT></B><FONT face="Courier New" color=black \
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">
</SPAN></FONT><B><FONT face="Courier New" color=#7f0055 size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; COLOR: #7f0055; FONT-FAMILY: \
'Courier New'">static</SPAN></FONT></B><FONT face="Courier New" color=black \
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">
</SPAN></FONT><B><FONT face="Courier New" color=#7f0055 size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; COLOR: #7f0055; FONT-FAMILY: \
'Courier New'">void</SPAN></FONT></B><FONT face="Courier New" color=black \
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">
main(String[] args) {</SPAN></FONT><FONT face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier \
New'"><o:p></o:p></SPAN></FONT></P> <P class=MsoNormal><FONT face="Courier New" \
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier \
New'"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier \
New'"> File[] \
schemaPath = {</SPAN></FONT><B><FONT face="Courier New" color=#7f0055 size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; COLOR: #7f0055; FONT-FAMILY: \
'Courier New'">new</SPAN></FONT></B><FONT face="Courier New" color=black \
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">
File(</SPAN></FONT><FONT face="Courier New" color=#2a00ff size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: #2a00ff; FONT-FAMILY: 'Courier \
New'">"Apparel.jar"</SPAN></FONT><FONT face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">),
</SPAN></FONT><B><FONT face="Courier New" color=#7f0055 size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; COLOR: #7f0055; FONT-FAMILY: \
'Courier New'">new</SPAN></FONT></B><FONT face="Courier New" color=black \
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">
File(</SPAN></FONT><FONT face="Courier New" color=#2a00ff size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: #2a00ff; FONT-FAMILY: 'Courier \
New'">"Books.jar"</SPAN></FONT><FONT face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier \
New'">)};</SPAN></FONT><FONT face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier \
New'"><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier \
New'"> SchemaTypeLoader stl = \
XmlBeans.<I><SPAN
style="FONT-STYLE: italic">typeLoaderForResource</SPAN></I>(XmlBeans.<I><SPAN
style="FONT-STYLE: \
italic">resourceLoaderForPath</SPAN></I>(schemaPath));</SPAN></FONT><FONT \
face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier \
New'"><o:p></o:p></SPAN></FONT></P> <P class=MsoNormal><FONT face="Courier New" \
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier \
New'"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier \
New'"> stl = XmlBeans.<I><SPAN
style="FONT-STYLE: italic">typeLoaderUnion</SPAN></I>(</SPAN></FONT><B><FONT
face="Courier New" color=#7f0055 size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; COLOR: #7f0055; FONT-FAMILY: \
'Courier New'">new</SPAN></FONT></B><FONT face="Courier New" color=black \
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">
SchemaTypeLoader[]{XmlBeans.<I><SPAN
style="FONT-STYLE: italic">getBuiltinTypeSystem</SPAN></I>(),
stl}); </SPAN></FONT><FONT
face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier \
New'"><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier \
New'"> </SPAN></FONT><FONT face="Courier \
New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier \
New'"><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier \
New'"> SchemaType st = \
stl.findDocumentType(</SPAN></FONT><B><FONT face="Courier New" color=#7f0055 \
size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; COLOR: #7f0055; FONT-FAMILY: \
'Courier New'">new</SPAN></FONT></B><FONT face="Courier New" color=black \
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">
QName(</SPAN></FONT><FONT face="Courier New" color=#2a00ff size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: #2a00ff; FONT-FAMILY: 'Courier \
New'">"com.</SPAN></FONT><FONT face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier \
New'">mysite</SPAN></FONT><FONT face="Courier New" color=#2a00ff size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: #2a00ff; FONT-FAMILY: 'Courier \
New'">.XMLSchema.Apparel"</SPAN></FONT><FONT face="Courier New" color=black \
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">,
</SPAN></FONT><FONT face="Courier New" color=#2a00ff size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: #2a00ff; FONT-FAMILY: 'Courier \
New'">"ItemDataFeed"</SPAN></FONT><FONT face="Courier New" color=black size=2><SPAN \
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier \
New'">));</SPAN></FONT><FONT face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier \
New'"><o:p></o:p></SPAN></FONT></P> <P class=MsoNormal><FONT face="Courier New" \
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier \
New'"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier \
New'"> \
com.mysite.XMLSchema.Apparel.ItemDataFeedDocument newDoc1 =
(com.mysite.XMLSchema.Apparel.ItemDataFeedDocument)stl.newInstance(st,
</SPAN></FONT><B><FONT face="Courier New" color=#7f0055 size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; COLOR: #7f0055; FONT-FAMILY: \
'Courier New'">null</SPAN></FONT></B><FONT face="Courier New" color=black \
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier \
New'">);</SPAN></FONT><FONT face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier \
New'"><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier \
New'"> \
com.mysite.XMLSchema.Accessories.ItemDataFeedDocument newDoc2 =
(com.mysite.XMLSchema.Accessories.ItemDataFeedDocument)stl.newInstance(st,
</SPAN></FONT><B><FONT face="Courier New" color=#7f0055 size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; COLOR: #7f0055; FONT-FAMILY: \
'Courier New'">null</SPAN></FONT></B><FONT face="Courier New" color=black \
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier \
New'">);</SPAN></FONT><FONT face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier \
New'"><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier \
New'"> </SPAN></FONT><FONT face="Courier \
New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier \
New'"><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier \
New'">
com.mysite.XMLSchema.Apparel.ItemDataFeedDocument.ItemDataFeed apparel =
newDoc1.addNewItemDataFeed();</SPAN></FONT><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier \
New'"><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier \
New'">
com.mysite.XMLSchema.Apparel.ItemDataFeedDocument.ItemDataFeed.Items
apparelItems = apparel.addNewItems();</SPAN></FONT><FONT
face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier \
New'"><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier \
New'">
com.mysite.XMLSchema.Apparel.ItemDataFeedDocument.ItemDataFeed.Items.Item
aItem = apparelItems.addNewItem();</SPAN></FONT><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier \
New'"><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier \
New'">
com.mysite.XMLSchema.Apparel.ItemDataFeedDocument.ItemDataFeed.Items.Item.ItemProperties \
itemProp = aItem.addNewItemProperties();</SPAN></FONT><FONT
face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier \
New'"><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier \
New'">
itemProp.setAge(com.mysite.XMLSchema.Apparel.AgeType.</SPAN></FONT><I><FONT
face="Courier New" color=#0000c0 size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: #0000c0; FONT-STYLE: italic; FONT-FAMILY: \
'Courier New'">TEEN</SPAN></FONT></I><FONT face="Courier New" color=black \
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier \
New'">);</SPAN></FONT><FONT face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier \
New'"><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier \
New'"> </SPAN></FONT><FONT face="Courier \
New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier \
New'"><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier \
New'">
System.</SPAN></FONT><I><FONT face="Courier New" color=#0000c0
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: #0000c0; FONT-STYLE: italic; FONT-FAMILY: \
'Courier New'">out</SPAN></FONT></I><FONT face="Courier New" color=black \
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier \
New'">.println(newDoc1.toString());</SPAN></FONT><FONT face="Courier New" \
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier \
New'"><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier \
New'"> }</SPAN></FONT><FONT face="Courier New" \
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier \
New'"><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier \
New'">}</SPAN></FONT><FONT face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier \
New'"><o:p></o:p></SPAN></FONT></P> <P class=MsoNormal><FONT face=Arial size=2><SPAN \
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">But </SPAN></FONT><FONT
face="Courier New" color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">SchemaType
st </SPAN></FONT><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">would just return null? What
am I doing wrong and is there a better solution to the problem? I just
want to be able to create new instances of the xmlbean classes that have
the same namespace and element name (but different internal structures for
the complex types). Then set some values for the elements and write to
file.<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Any help is greatly
appreciated.<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: \
Arial">John<o:p></o:p></SPAN></FONT></P></BLOCKQUOTE></DIV><BR>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.</BLOCKQUOTE><BR>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.</BLOCKQUOTE></BODY></HTML>
<br>
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.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic