setSelectedElement method doesn't work

X-Application Version:
Tamino Version : 3.1.1
Platform : NT 4 sp6
WebContainer : Tomcat 3.3.1
JDK Version : 1.3.1_01

I’m using the Tamino XApplication Java API. I’m trying to read part of a XML document with “setSelectedElement” method of the QueryContainer Class. but it doesn’t work.

Please, in order to check this, change the line:

QueryContainer query = new QueryContainer(“Property”);

in the program [XApplication Directory]\examples\api\src\com\softwareag\xtools\xapplication\examples\api\property)

For these lines:

QueryContainer query = new QueryContainer();
QueryBuilder qb = new QueryBuilder(query);
System.out.println(“Query:” + qb.buildQueryExpression());

System.out.println(“getSelectedElement():” + query.getSelectedElement() );

you will see that always is read all the Property document.

Thanks and Regards,

[This message was edited by Christian Freytag on 06 Aug 2002 at 07:17.]


thank you for the note. The problem is that didn?t adapt our X-Application Java API examples to our new query concept. They are still based on the query classes. These classes do not provide the hole query capability of Tamino XQL expression. It is difficult to extend these classes for new features coming up with new Tamino versions. Therefore, we decided to spend no more time for further development on the query classes. Instead of, we added a query method to the workspace which accepts an XQL expression as string.

For getting only the ?Price? element you can use

<BR>BusinessDocumentWorkspace ws = new BusinessDocumentWorkspace(store);<BR>Cursor docCursor = ws.query("buyPrices", "Property", "/Property[@Category='Buy']/Price", 15);<BR>int counter = 0;<BR>while (docCursor.hasNext()) {<BR>    BusinessDocument doc = (BusinessDocument);<BR>    counter++;<BR>    System.out.println(?? + counter + ?: Price = " + doc.selectElement(".").getText());<BR>}<BR>docCursor.close();<BR>

Does this query handling help you or is it necessary to provide a object oriented support for query expressions?

However, you are right: Setting a “selected element” has no effect. The query builder ignores this attribute of the query container. Therefore I will mark the topic with the “bug” icon.


[This message was edited by Christian Freytag on 07 Aug 2002 at 06:46.]

Hi Christian,
Thanks a lot for your help. I didn’t find the method query (String queryID, String XPath) in BusinessDocumentWorkspace Class. Instead I’m using:
query(String documentName,
String schemaName,
String queryExpression,
int pageSize)

Now i can use a XQL expression, but the pageSize parameter doesn’t work. The query always read all the documents. That is not a problem for me. It could be solved in the future.



yes, I will change the example I posted. I didn’t look into the JavaDocs when I wrote the example.

Concerning the pagesize parameter:

It is an internal parameter which controls the number of documents delivered by one request. Let’s assume there are 100 documents matching your query. With a pagesize of 5 the cursor requests only 5 documents per request. If the iteration comes to the last of the received documents the next 5 documents are requested. This is controlled internally by the Tamino API for Java. When using the cursor of X-Application, the effect of the pagesize is not visible.