Hi, the setList works now fine when using xsd:any but I now get a exception when saving:
<?xml version="1.0" encoding="ASCII"?> <listresponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="listresponse"> <objectclass>test</objectclass> <content/> org.eclipse.emf.ecore.resource.Resource$IOWrappedException: The object '[EMAIL PROTECTED] (eClass: [EMAIL PROTECTED] (name: datasource) (instanceClassName: null) (abstract: false, interface: false))' is not contained in a resource. at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.endSave(XMLSaveImpl.java:284) at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.save(XMLSaveImpl.java:247) at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doSave(XMLResourceImpl.java:203) at org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(ResourceImpl.java:993) at org.apache.tuscany.sdo.helper.XMLDocumentImpl.save(XMLDocumentImpl.java:205) at org.apache.tuscany.sdo.helper.XMLDocumentImpl.save(XMLDocumentImpl.java:159) at org.apache.tuscany.sdo.helper.XMLHelperImpl.save(XMLHelperImpl.java:163) at org.apache.tuscany.sdo.helper.XMLHelperImpl.save(XMLHelperImpl.java:149) at com.bes.itm.sdo.test.RequestTest.testSetContent(RequestTest.java:74) although content.setList("datasource", list); adds the sub-DO into the "content" object. Probably has to do with the declaration of the content as xsd:any When I look into the OpenType example in the 1.0 distributio that I'm using, it uses Property prop = scope.getXSDHelper().getGlobalProperty(NS_CODA, "datasource", true); but this always returns null? what is wrong with the original approach as seen below? --- <xsd:complexType name="content"> <xsd:sequence> <xsd:any minOccurs="0" maxOccurs="unbounded" namespace="##any" processContents="lax"/> </xsd:sequence> </xsd:complexType> --- DataObject resp = scope.getDataFactory().create(RequestUtils.NS_REQ, "listresponse"); resp.setString(RequestUtils.ATTR_OBJCLASS, "test"); TypeHelper th = scope.getTypeHelper(); Type type = th.getType(NS_CODA, "datasource"); DataFactory df = scope.getDataFactory(); // construct list of datasource DOs List<DataObject> list = new ArrayList<DataObject>(); DataObject dobj = df.create(type); dobj.setString("name", "test1"); dobj.setString("description", "test1"); list.add(dobj); dobj = df.create(type); dobj.setString("name", "test2"); dobj.setString("description", "test2"); list.add(dobj); // create content wrapper DataObject content = scope.getDataFactory().create(RequestUtils.NS_REQ, "content"); resp.setDataObject("content", content); // set xsd:any element content.setList("datasource", list); // output scope.getXMLHelper().save(resp, RequestUtils.NS_REQ, "listresponse", System.out); --- Frank Budinsky wrote: > Hi Peter, > > This should work: > > <xsd:element name="content" type="xsd:anyType" minOccurs="0" > maxOccurs="unbounded"/> > > I think the problem is just a typo. Your declaration says > maxOccurs="unbound" Peter
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]