XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Doug LundinSubject: Finding a string within an XML document using XQuery
Author: Doug Lundin
Date: 11 May 2006 11:17 AM
I've got an XQuery file created and would like to search an XML document - the entire document and not just a specific node - for a given string. Is this possible?

Thanks

Postnext
(Deleted User) Subject: Finding a string within an XML document using XQuery
Author: (Deleted User)
Date: 11 May 2006 12:30 PM
Originally Posted: 11 May 2006 12:28 PM
Hi Doug

Depending on what you want to do you can use

contains(string(/), "stringtosearch")

or

matches(string(/), "stringtosearch")

or another similar String function. Refer to

http://www.w3.org/TR/xpath-functions/#string-functions

for all String related functionss

Regards
-Srini

Postnext
Doug LundinSubject: Finding a string within an XML document using XQuery
Author: Doug Lundin
Date: 11 May 2006 01:03 PM
Srini,

Thanks but I should have also asked about parsing what follows the string out as XML. I found the matches and contains functions but they return boolean. I didn't see any other functions that could be used - though I am sure they exist. Would you kindly complete the loop with this additional info?

Thanks

Posttop
(Deleted User) Subject: Finding a string within an XML document using XQuery
Author: (Deleted User)
Date: 11 May 2006 01:41 PM
Hi Doug

I am not sure if you want to rely on String functions in that case. You need to use expressions that would return back specific element that contains your search string and then parse the following elements.

Regards
Srini

 
Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.