Mark, I do just what your asking. I load and parse a schema, generate the xsb's then for each SchemaType in the typesystem I get the java classname. After that I load the generated java files using Janino, using the classloader for java source which compiles them on the fly and then do some introspection/futher work using the class.
My code is spread across a number of java source file. If you want mail me offline and I'll see about extracting the code into a mail for you. Regards Don -----Original Message----- From: Mark Hansen [mailto:[EMAIL PROTECTED] Sent: 07 September 2005 18:49 To: [email protected] Subject: using SchemaType.getFullJavaName with dynamically compiled schema I would like to do the following: (1) Compile a schema on the fly using XmlBeans.compileXsd (2) Inspect the resulting SchemaType instances to get information about their underlying Java methods so that I can use these methods to manipulate the instances. But, it seems that the compileXsd method (below) does not create the "Java Types Generated from User-Derived Schema" (as defined in docs/guide/conJavaTypesGeneratedFromUserDerived.html), but only the SchemaTypeSystem representations. public static SchemaTypeSystem compileXsd(XmlObject[] schemas, SchemaTypeLoader typepath, XmlOptions options) throws XmlException It seems that if I want to generate the Java Types, then I would need to use XmlBeans.compileXmlBeans. But, in order to use that method, I need to get an instance of BindingConfig and Filer, which seem to be empty implementations at this point. How can I create te Java Types on the fly so that methods such as SchemaType.getFullJavaName will work? Right now, these methods always return null. My code and sample output are below. Code Snippet ============ SchemaTypeSystem schemaTypeSystem = XmlBeans.compileXsd (new XmlObject[] {schema}, XmlBeans.getBuiltinTypeSystem(), null); SchemaTypeLoader schemaTypeLoader = XmlBeans.typeLoaderUnion( new SchemaTypeLoader[] { schemaTypeSystem, XmlBeans.getBuiltinTypeSystem() }); QName poElementQName = new QName("http://javector.com/samples", "PurchaseOrder"); SchemaType poElementType = schemaTypeLoader.findElement(poElementQName).getType(); String poElementJavaName = poElementType.getFullJavaName(); System.out.println("PurchaseOrder element (root) has signature: " + poElementType.toString()); System.out.println("PurchaseOrder element (root) has java class: " + poElementJavaName); Output ====== PurchaseOrder element (root) has signature: E=PurchaseOrder|[EMAIL PROTECTED]://javector.com/samples PurchaseOrder element (root) has java class: null --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

