Who Knows this proplem?
If I try to query my Database in this form: /articles[node()~=“web”]//node()[.~=“web”] everything is OK and I can iterate through my TJDOMElementIterator.
But as soon as my query looks like this: /articles[node()~="web" or node()~=“internet”]//node()[.~=“web” or .~=“internet”], my Database only throws exceptions (Bogus chunk size…)
Who can help my! What have i made wrong! What must i do to avoid these kind of exception.
Java code example:
import com.softwareag.tamino.db.api.accessor.TAccessLocation;
import com.softwareag.tamino.db.api.accessor.TQuery;
import com.softwareag.tamino.db.api.accessor.TQueryException;
import com.softwareag.tamino.db.api.accessor.TXMLObjectAccessor;
import com.softwareag.tamino.db.api.connection.TConnection;
import com.softwareag.tamino.db.api.connection.TConnectionFactory;
import com.softwareag.tamino.db.api.connection.TServerNotAvailableException;
import com.softwareag.tamino.db.api.objectModel.TIteratorException;
import com.softwareag.tamino.db.api.objectModel.TNoSuchXMLObjectException;
import com.softwareag.tamino.db.api.objectModel.jdom.TJDOMElementIterator;
import com.softwareag.tamino.db.api.objectModel.jdom.TJDOMObjectModel;
public class example {
public static void main(String[] args) {
TConnectionFactory connectionFactory = TConnectionFactory.getInstance();
TConnection connection = null;
try {
connection =
connectionFactory.newConnection(
"http://localhost/tamino/mydatabase/");
} catch (TServerNotAvailableException e) {
e.printStackTrace();
}
TXMLObjectAccessor dataAccessor =
connection.newXMLObjectAccessor(
TAccessLocation.newInstance("articles"),
TJDOMObjectModel.getInstance());
String query =
"/*[node()~=\"web\" or node()~=\"internet\"]//node()[.~=\"web\" or .~=\"internet\"]";
try {
TJDOMElementIterator idt = queryIDT(dataAccessor, query);
while (idt.hasNext()) {
try {
System.out.println(idt.next().getName());
} catch (TNoSuchXMLObjectException e2) {
e2.printStackTrace();
} catch (TIteratorException e2) {
e2.printStackTrace();
}
}
} catch (TServerNotAvailableException e1) {
e1.printStackTrace();
} catch (TQueryException e1) {
e1.printStackTrace();
}
}
public synchronized static TJDOMElementIterator queryIDT(
TXMLObjectAccessor dataAccessor,
String query)
throws TServerNotAvailableException, TQueryException {
TQuery querya = TQuery.newInstance(query);
TJDOMElementIterator result =
new TJDOMElementIterator(
dataAccessor.query(querya).getXMLObjectIterator());
return result;
}
}
[This message was edited by keppus on 21 March 2004 at 12:40.]