Use the setWithCreate function to create a single instance of nested business object.
<?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:complexType name="Parent"> <xsd:sequence> <xsd:element name="name" type="xsd:string"/> <xsd:element name="child" type="Child"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="Child"> <xsd:sequence> <xsd:element name="name" type="xsd:string"/> <xsd:element name="grandChild" type="GrandChild"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="GrandChild"> <xsd:sequence> <xsd:element name="name" type="xsd:string"/> </xsd:sequence> </xsd:complexType> </xsd:schema>
DataObject parent = ... DataObject child = parent.createDataObject("child"); DataObject grandchild = child.createDataObject("grandChild"); grandchild.setString("name", "Bob");
DataObject parent = ... parent.setString("child/grandchild/name", "Bob");
The lower-level business object data is set without having to reference the intermediate-level business object. An exception occurs if the path is not valid.