Really roughly, off the top of my head and not compiled (let alone tested):
public void dropEmptyValues (IData aDoc)
{
IDataCursor vCsr = aDoc.getCursor();
boolean vOk = vCsr.first();
while (vOk)
{
Object vValue = vCsr.getValue();
if (vValue == null)
vOk = vCsr.delete(); // moves to next value if there is one
else
if (vValue instanceof String && ((String)vValue).equals(""))
vOk = vCsr.delete();
else
{
// recurse through child docs
// beware of reference loops (not checked here)
if (vValue instanceof IData)
dropEmptyValues((IData)vValue);
else
if (vValue instanceof IData[])
{
IData vDocs[] = (IData[])vValue;
for (int i = 0; i < vDocs.length; i++)
dropEmptyValues(vDocs[i]);
}
vOk = vCsr.next();
}
}
vCsr.destroy();
}
HTH!
#webMethods#Flow-and-Java-services#Integration-Server-and-ESB