Hey Trevor!
I’m glad that you replied. 
I’ve tried what you suggested. The outcome was:
The part where you change the query to string, I think it’s the same. Both display the same results.
I went to check the method getQueryContentAsString(), it says: If the result is a value or a set of values, the string returned is the concatenation of these values.
Anyway, the codes I’m using are:
//Instantiate an empty TXMLObject instance using the DOM object model
TXMLObject xmlObject = TXMLObject.newInstance(TDOMObjectModel.getInstance());
//Establish the Tamino connection
TConnection connection = TConnectionFactory.getInstance().newConnection(DATABASE_URI);
//Obtain a TXMLObjectAccessor with a DOM object model
TXMLObjectAccessor xmlObjectAccessor = connection.newXMLObjectAccessor(TAccessLocation.newInstance(“TCM”),TDOMObjectModel.getInstance());
//Invoke the query operation
TQuery query = TQuery.newInstance(docName + “[//RIREG~=‘" + name + "’]/ID”);
TResponse response = xmlObjectAccessor.query(query);
TXMLObjectIterator myIterator = response.getXMLObjectIterator();
while (myIterator.hasNext())
{
TXMLObject xmlObjectReturned = myIterator.next();
xmlObjectReturned.writeTo(stringWriter);
stringWriter.write(“\n”);
searchCount++;
}
//Print out the results and number of results are returned
//System.out.println(stringWriter);
System.out.println(response.getQueryContentAsString());
System.out.println("Number: " + searchCount);
Thank you for your help,
-KAren-

#API-Management#webMethods-Tamino-XML-Server-APIs#webMethods