[xquery-talk] Regular Expression search
mhk at mhk.me.uk
Mon Dec 12 12:40:33 PST 2005
Firstly, it's not good XML design to use structured names for elements.
Rather than have two elements <subTagA> and <subTagB> it's better design to
use <subTag type="A"> and <subTag type="B">. But of course you sometimes
have to query badly-designed XML.
Secondly, you don't actually need regular expressions (though you can use
them if you want: see the matches() function). You can achieve this using
//*[starts-with(name(), 'subTag')][starts-with(., 'MyNameIs')]
From: talk-bounces at xquery.com [mailto:talk-bounces at xquery.com] On Behalf Of
Sent: 12 December 2005 12:21
To: talk at xquery.com
Subject: [xquery-talk] Regular Expression search
lately I've been trying to build a xquery search that contains regular
expressions to get my result, but I couldnt make it. So I would like to know
how to search within a xml structure for some generic tags. For example:
How do I search for subTags that begins with "MyNameIs" and ends with
anything else so I can have both subTags on my result? Thanks in advance,
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the talk