protected Object getControlObject() {
   XMLRoot xmlRoot = new XMLRoot();
   MailingAddress address = new MailingAddress();
   xmlRoot.setLocalName("theAddress");
   xmlRoot.setObject(address);
   return xmlRoot;
 }
  protected Object getControlObject() {
    Employee employee = new Employee();
    employee.setName(CONTROL_EMPLOYEE_NAME);

    XMLRoot xmlRoot = new XMLRoot();
    xmlRoot.setLocalName(CONTROL_ELEMENT_NAME);
    xmlRoot.setNamespaceURI(CONTROL_NAMESPACE_URI);
    xmlRoot.setObject(employee);
    return xmlRoot;
  }
  public Object getControlObject() {
    Person peep = new Person();
    peep.setName(CONTROL_PERSON_NAME);

    XMLRoot xmlRoot = new XMLRoot();
    xmlRoot.setLocalName(CONTROL_ELEMENT_NAME);
    xmlRoot.setNamespaceURI(CONTROL_NAMESPACE_URI);
    xmlRoot.setObject(peep);
    return xmlRoot;
  }
  public Object getControlObject() {
    Root root = new Root();

    XMLRoot xmlroot = new XMLRoot();
    xmlroot.setObject("child's text");
    xmlroot.setLocalName("myns:theXMLRoot");
    xmlroot.setNamespaceURI("www.example.com/some-dir/some.xsd");

    root.setAny(xmlroot);
    return root;
  }
  public void xmlToObjectTest(Object testObject) throws Exception {
    log("\n**testXMLDocumentToObject**");
    log("Expected:");
    log(getReadControlObject().toString());
    log("Actual:");
    log(testObject.toString());

    XMLRoot controlObj = (XMLRoot) getReadControlObject();
    XMLRoot testObj = (XMLRoot) testObject;

    this.assertEquals(controlObj.getLocalName(), testObj.getLocalName());
    this.assertEquals(controlObj.getNamespaceURI(), testObj.getNamespaceURI());
    this.assertEquals(controlObj.getObject(), testObj.getObject());
  }
  public XMLDocument load(Source source, String locationURI, Object options) throws IOException {
    // get XMLUnmarshaller once - as we may create a new instance if this helper isDirty=true
    XMLUnmarshaller anXMLUnmarshaller = getXmlUnmarshaller(options);
    Object unmarshalledObject = null;
    if (options == null) {
      try {
        unmarshalledObject = anXMLUnmarshaller.unmarshal(source);
      } catch (XMLMarshalException xmlException) {
        handleXMLMarshalException(xmlException);
      }
    } else {
      try {
        DataObject optionsDataObject = (DataObject) options;
        try {
          SDOType theType = (SDOType) optionsDataObject.get(SDOConstants.TYPE_LOAD_OPTION);
          try {
            if (theType != null) {
              unmarshalledObject = anXMLUnmarshaller.unmarshal(source, theType.getImplClass());
            } else {
              unmarshalledObject = anXMLUnmarshaller.unmarshal(source);
            }
          } catch (XMLMarshalException xmlException) {
            handleXMLMarshalException(xmlException);
          }
        } catch (ClassCastException ccException) {
          throw SDOException.typePropertyMustBeAType(ccException);
        }
      } catch (ClassCastException ccException) {
        throw SDOException.optionsMustBeADataObject(
            ccException, SDOConstants.ORACLE_SDO_URL, SDOConstants.XMLHELPER_LOAD_OPTIONS);
      }
    }

    if (unmarshalledObject instanceof XMLRoot) {
      XMLRoot xmlRoot = (XMLRoot) unmarshalledObject;
      XMLDocument xmlDocument =
          createDocument(
              (DataObject) ((XMLRoot) unmarshalledObject).getObject(),
              ((XMLRoot) unmarshalledObject).getNamespaceURI(),
              ((XMLRoot) unmarshalledObject).getLocalName());
      if (xmlRoot.getEncoding() != null) {
        xmlDocument.setEncoding(xmlRoot.getEncoding());
      }
      if (xmlRoot.getXMLVersion() != null) {
        xmlDocument.setXMLVersion(xmlRoot.getXMLVersion());
      }
      xmlDocument.setSchemaLocation(xmlRoot.getSchemaLocation());
      xmlDocument.setNoNamespaceSchemaLocation(xmlRoot.getNoNamespaceSchemaLocation());
      return xmlDocument;
    } else if (unmarshalledObject instanceof DataObject) {
      DataObject unmarshalledDataObject = (DataObject) unmarshalledObject;
      String localName =
          ((SDOType) ((DataObject) unmarshalledObject).getType())
              .getXmlDescriptor()
              .getDefaultRootElement();
      if (localName == null) {
        localName = ((SDOType) ((DataObject) unmarshalledObject).getType()).getXsdLocalName();
      }
      return createDocument(
          unmarshalledDataObject, unmarshalledDataObject.getType().getURI(), localName);
    } else if (unmarshalledObject instanceof XMLDocument) {
      return (XMLDocument) unmarshalledObject;
    }
    return null;
  }