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]

Reply via email to