Hi Frank (or anyone else that may be able to help), I have a related question to Ashish's. I have the following two schemas:
<?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/Person" xmlns:person="http://www.example.org/Person" elementFormDefault="qualified"> <xsd:element name="Person" type="person:PersonType"></xsd:element> <xsd:complexType name="PersonType"> <xsd:sequence> <xsd:element name="Name" type="xsd:string"></xsd:element> <xsd:element name="Age" type="xsd:string"></xsd:element> <xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> </xsd:schema> <?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/Address" xmlns:address="http://www.example.org/Address" elementFormDefault="qualified"> <xsd:element name="Address" type="address:AddressType"></xsd:element> <xsd:complexType name="AddressType"> <xsd:sequence> <xsd:element name="Street" type="xsd:string"></xsd:element> <xsd:element name="City" type="xsd:string"></xsd:element> <xsd:element name="Zip" type="xsd:string"></xsd:element> </xsd:sequence> </xsd:complexType> </xsd:schema> I use the following code to generate my XML: public static void main(String[] args) throws Exception { HelperContext context = SDOUtil.createHelperContext(); context.getXSDHelper().define(new FileInputStream("./Person.xsd"), (new File("./Base.xsd")).toURI().toString()); context.getXSDHelper().define(new FileInputStream("./Address.xsd"), (new File("./Additional.xsd")).toURI().toString()); DataObject person = context.getDataFactory().create("http://www.example.org/Person", "PersonType"); DataObject address = context.getDataFactory().create("http://www.example.org/Address", "AddressType"); person.set("Name", "Bart"); person.set("Age", "10"); address.set("Street", "123 Fake St."); address.set("City", "Springfield"); address.set("Zip", "46392"); person.setDataObject("address:Address", address); context.getXMLHelper().save(person, "http://www.example.org/Person", "Person", System.out); } This gives the following XML: <?xml version="1.0" encoding="ASCII"?> <person:Person xmlns:PersonType="http://www.example.org/Person/PersonType" xmlns:address="http://www.example.org/Address" xmlns:person="http://www.example.org/Person"> <person:Name>Bart</person:Name> <person:Age>10</person:Age> <PersonType:Address> <address:Street>123 Fake St.</address:Street> <address:City>Springfield</address:City> <address:Zip>46392</address:Zip> </PersonType:Address> </person:Person> My concern is the "PersonType:Address" element. I'd like that to be "address:Address" instead. Am I doing something wrong in my schema definitions and/or code? Thanks for any help you can provide, -Chris On 4/16/07, Frank Budinsky <[EMAIL PROTECTED]> wrote:
Ashish, I implemented the on-the-fly property creation support over the weekend (see https://issues.apache.org/jira/browse/TUSCANY-1211). You should now be able to do what you asked: body.setDataObject("anyType",DataObject); Let me know how it works. Thanks, Frank
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
