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 = BeanGenerator.class.getResourceAsStream("xsd/schema1.xsd"); final XmlObject schema1 = XmlObject.Factory.parse(schema1Stream); final InputStream schema2Stream = BeanGenerator.class.getResourceAsStream("xsd/schema2.xsd"); final XmlObject schema2 = XmlObject.Factory.parse(schema2Stream); final XmlObject[] schemas = { schema1, schema2 }; final BindingConfig config = new BindingConfig() { @Override 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(); options.setCompileDownloadUrls(); XmlBeans.compileXmlBeans(null, null, schemas, config, null, filer, options); 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 schemaorg_apache_xmlbeans.system.s2EF0617F3F8756BE32108E3CF22693B4.TypeSystemHolder. Make sure the generated binary files are on the classpath. at org.apache.xmlbeans.XmlBeans.typeSystemForClassLoader(XmlBeans.java:783) ... 29 more Caused by: java.lang.ClassNotFoundException: schemaorg_apache_xmlbeans.system.s2EF0617F3F8756BE32108E3CF22693B4.TypeSystemHolder 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) at org.apache.xmlbeans.XmlBeans.typeSystemForClassLoader(XmlBeans.java:769) ... 30 more What is the problem here? Why is this class not generated? Thanks for a response Michael --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@xmlbeans.apache.org For additional commands, e-mail: user-h...@xmlbeans.apache.org