Exception with method TXMLObjectAccessor.update

I am having a problem updating my tamino database from java using the TXMLObjectAccessor class. I am fairly
new to Tamino but I am competent in java and would really appreciate some help from anyone who knows about
the Tamino Java API.

Everything seems to work okay until I call the TXMLObjectAccessor update method in Step 11, at which point I
get a TAccessorException with the message:

Tamino access failure (7935, INOXDE7935, Schema not found, Failed to
locate schema for doctype ‘ctxO:OrganisationalPerson’ in collection ‘contractXOrg’.),
tag: JavaTaminoAPI_4_2_0_53, java: 1.4.1, os: Windows 2000 5.0 ):

The Tamino collection is contractXOrg.
The Document loaded into this collection is ctxO:contractXOrganisation.
The structure of the document is recursive.
The document is as follows:

<ctxO:contractXOrganisation xmlns:ctxO=“contractX/contractXOrganisation”
xmlns:tsd=“http://namespaces.softwareag.com/tamino/TaminoSchemaDefinition
xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance
xsi:schemaLocation=“contractX/contractXOrganisation …\xml\contractXOrganisation.tsd”>
ctxO:oTestOrg</ctxO:o>

I am using the following steps to get to this point and I think the problem is to do with namespaces and the
fact that I am trying to update a sub-section of a larger document.

I am trying to update an OrganisationPerson but the TXMLObject probably doesn’t point to the correct level.

So my questions are:

How do I update the TXMLObject so that it knows where to put my updated document and secondly, is this actually
the best/correct way to perform the update?

// Step 1 : Define local objects

String aCollection = "contractXOrg";
    TConnection myConnection = null;
    SidTaminoDatabaseConnection aDBConnection = null;
    TXMLObject o = null;
    
    try
    {
        // Step 2 : Get a Database Connection
        aDBConnection = getTaminoConnection();
        
        // Step 3 : Obtain a TXMLObjectAccessor with a DOM object model, passing in the collection name
        TXMLObjectAccessor accessor = myConnection.newXMLObjectAccessor(TAccessLocation.newInstance( aCollection ), TDOMObjectModel.getInstance() );

        // Step 4: Find the data we want to update
        TQuery q = TQuery.newInstance("/ctxO:contractXOrganisation/ctxO:OrganisationalUnit/ctxO:OrganisationalPerson[ctxO:cn='" + theUser.getUserName() + "']");

        // Step 5 : Get a transaction object for later commit...
        TLocalTransaction trans = myConnection.useLocalTransactionMode();

        // Step 6: Execute the query and get the response...
        TResponse r = accessor.query(q);
        System.out.println("Response to query getUser(): " + r.getReturnValue());
        
        
        // Step 7 : Iterate around any documents we find, should only be one for this user
        // Get an iterator to iterate through the result set (probably just the one result)...
        TXMLObjectIterator it = r.getXMLObjectIterator();

        // Get the first record 
        if(it.hasNext())
        {
            o = it.next();

        	// Step 8 : Get the Document	
            Document aDoc = (Document)o.getDocument();
            
         	// Step 9 : Get the Element we want to change    
            NodeList aNodeList = aDoc.getElementsByTagName("ctxO:sn");    
            Element el = (Element)aNodeList.item(0);
            String textVal = el.getFirstChild().getNodeValue();
        
        	// Step 10 : Change the value
        	el.getFirstChild().setNodeValue("xxxxxxx");
            textVal = el.getFirstChild().getNodeValue();
            
            // Output the results to see if things have updated 
            System.out.println("\nTest: ");
            o.writeTo(System.out);
                      
            // Step 11 : Perform Update
            accessor.update(o);
        }

    // Step 12 : Commit and Tidy up	       
        // Commit the transaction...
        trans.commit();
        
        // Reset the connection
        // Opposite of useLocalTransactionMode(), NB: the reset() method will perform a rollback
        myConnection.useAutoCommitMode();
        
    }

Any help would be most appreciated,

Thanks.
contractXOrganisation.tsd (9.91 KB)

Question has been answered privately.