Hi, Christophe, you are right, searchRequestElement contains the query as defined by DASL (see http://greenbytes.de/tech/webdav/draft-reschke-webdav-search-latest.html for current draft). When designing SEARCH, we discussed having a non-DOM data object for describing the query. A possible way would be to use the abstraction as used by WVCM. But then SEARCH would be limited to the basicsearch syntax (DASL is open to define other syntaxes). Everything is well defined in DASL, so we did not see an overwhelming advantage designing a different datastructure.
See following example for creating a simple query: ------------------------------------------------------------- import org.jdom.Element; import org.jdom.Namespace; import org.jdom.output.XMLOutputter; public class CreateSearch { public static void main(String[] args) throws Exception { Namespace davNamespace = Namespace.getNamespace ("d", "DAV:"); Element searchRequest = new Element ("searchRequest", davNamespace); Element basicSearch = new Element ("basicSearch", davNamespace); searchRequest.addContent (basicSearch); Element select = new Element ("select", davNamespace); basicSearch.addContent(select); Element prop = new Element ("prop", davNamespace); select.addContent(prop); prop.addContent(new Element ("getcontentlength", davNamespace)); Element from = new Element ("from", davNamespace); basicSearch.addContent(from); Element scope = new Element ("scope", davNamespace); from.addContent(scope); Element href = new Element ("href", davNamespace); href.addContent("myFolder"); scope.addContent(href); Element where = new Element ("where", davNamespace); basicSearch.addContent(where); Element gt = new Element ("gt", davNamespace); where.addContent (gt); Element p2 = new Element ("prop", davNamespace); gt.addContent(p2); p2.addContent(new Element ("getcontentlength", davNamespace)); Element literal = new Element ("literal", davNamespace); literal.addContent("10000"); p2.addContent(literal); XMLOutputter out = new XMLOutputter (" ", true); out.output (searchRequest, System.out); } } ------------------------------------------------------------------------- This sample creates a searchRequest Element which displays as: <d:searchRequest xmlns:d="DAV:"> <d:basicSearch> <d:select> <d:prop> <d:getcontentlength /> </d:prop> </d:select> <d:from> <d:scope> <d:href>myFolder</d:href> </d:scope> </d:from> <d:where> <d:gt> <d:prop> <d:getcontentlength /> <d:literal>10000</d:literal> </d:prop> </d:gt> </d:where> </d:basicSearch> </d:searchRequest> which means nothing else than: Give me the contentlengths of all resources within or below myFolder, that are larger than 10000 bytes. Hope this helps, Martin -----Original Message----- From: Christophe [mailto:[EMAIL PROTECTED] Sent: Dienstag, 6. Januar 2004 21:14 To: Slide Users Mailing List Subject: Re: SlideAPI: SearchHelper If I remember correctly, searchRequestElement is a xml jdom element which contains the complete search criteria. the grammareUri is the namespace uri defined in this jdom element. There is a sample in : jakarta-slide\src\webdav\server\org\apache\slide\webdav\method\SearchMethod. java. So, we are at least 2 (you and me :-) ) who are using Slide without the webdav layer. Now, I have a question for the committers : is it not interesting to have less coupling between the webdav layer and this search helper class. My point of view is it is better to have a real "data object" instead of a jdom element. I have no idea on how to build this jdom element if I'm not using the webdav layer. Or at least, maybe someone can point to a document which describe how to build those parameters. Christophe Antonio Jean Claude wrote: >Hello again Sliders, > >I try to use the SearchQuery (see code below) but I have no clue on how to use the String grammarUri and the Element searchRequestElement. >I looked in the newsgroup archive without success. >Does anyone know how to construct a simple query on name? > >Thanks. I'm using Slide2.0 > >JClaude > >Search searchHelper = token.getSearchHelper(); >SearchQuery searchQuery = searchHelper.createSearchQuery > (grammarUri?, searchRequestElement?, slideToken, maxDepth); > >--------------------------------------------------------------------- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]