Hi all

I have some xsd schemas in my source tree and I want to generate java
sources with XML Beans.
I cannot use ant or maven task, I have to do it in plain java.

I use the following java code:

final InputStream schema1Stream =
final XmlObject schema1 = XmlObject.Factory.parse(schema1Stream);
final InputStream schema2Stream =
final XmlObject schema2 = XmlObject.Factory.parse(schema2Stream);
final XmlObject[] schemas = { schema1, schema2 };
final BindingConfig config = new BindingConfig() {
   public String lookupPackageForNamespace(String uri) {
     return "ch.mypackage";

final Filer filer = new FilerImpl(null, new File(".java/src/"), null,
true, true);
final XmlOptions options = new XmlOptions();
XmlBeans.compileXmlBeans(null, null, schemas, config, null, filer,

I have questions:

1) The schemas have include statements like this: 

   <xs:include schemaLocation="./th000008_extern.xsd"/>

How can I make XmlBeans to include this schemas? Its located in the same
folder as the original schema, but XMLBeans does not
find it:

URL "./th000008_extern.xsd" is not well-formed

how to solve that?

2) I want everything XmlBeans generates in the package "ch.mypackage".
How can I to this? XmlBeans generates a lot of other stuff like xsb
files which are not in that package.

How can I say to XmlBeans to not generate this files?

3) When I use one of the generated classes, there is the following
runtime error:

java.lang.RuntimeException: Cannot load SchemaTypeSystem. Unable to load
class with name
Make sure the generated binary files are on the classpath.
    ... 29 more
Caused by: java.lang.ClassNotFoundException:
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 30 more

What is the problem here? Why is this class not generated?

Thanks for a response

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

Reply via email to