|
dynamic generation of xml files from an xsd: msg#00042text.xml.xmlbeans.user
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 |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: XmlBeans example: 00042, ying lcs |
|---|---|
| Next by Date: | SV: XPath problem: 00042, Iveland, Espen |
| Previous by Thread: | blank namespacei: 00042, gopi.rcr |
| Next by Thread: | RE: dynamic generation of xml files from an xsd: 00042, Jacob Danner |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |