There is a utility to generate sample xml instances from XSD via a command line tool. Check out xmlbeans_trunk\bin\xsd2inst The main class is located in org.apache.xmlbeans.impl.xsd2inst.SchemaInstanceGenerator
I'm not sure this will help you terribly as it sounds like you want to know about all the global elements in an XSD programmatically. If this is the case, I might suggest using the XmlCursor APIs to find all elements that are children of to the schema element. E.g /schema/element Best of luck, -Jacobd -----Original Message----- From: Javier [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 22, 2006 2:29 AM To: user@xmlbeans.apache.org Subject: dynamic generation of xml files from an xsd Hi I'm using Xmlbeans to create an xml editor. In this application you normally have an xsd to create xml files that conform to that schema. If I use xmlbeans at compile time there's no problem, I can generate the xmlbeans clases and interfaces and begin using them, but I now need to generate all this stuff at runtime, here's my initial code: ... // the schema XmlObject xmlobj = XmlObject.Factory.parse(new File(xsdFileName)); XmlObject foo[] = { xmlobj }; // the schema types: SchemaTypeLoader stl = XmlBeans.loadXsd(foo); Now, my problem is that I don't know how to find the propiate root document type to generate a new XML that conforms to the schema. I've tried: SchemaType sType = stl.typeForClassname("com.name.try.TryDocument"); XmlOptions options = new XmlOptions(); XmlObject mydoc = stl.newInstance(sType, options); with no success. The sType object is allways null and I don't know how to get my schema root element to generate an xml file. My schema looks something like this: <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://name.com/try" targetNamespace="http://name.com/try" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:element name="Try" type="TemplateType"/> <xs:complexType name="TemplateType"> <xs:sequence> <xs:element name="First" type="FirstType"/> ... </xs:schema> My understanding is that if I use static generation of xmlbeans i would have to search for a TryDocument interface and start from there. Any help would be greatly appreciated. Thanks -- Javier --------------------------------------------------------------------- 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]