|
[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message] Regular Expression searchElarrat, EFC eduardoelarrat at gmail.comMon Dec 12 10:59:33 PST 2005
Exactly, I just wanted to show you some structure, so you can show me how to buils what I asked for. Thanks On 12/12/05, Howard Katz <http://xquery.com/mailman/listinfo/talk> wrote: > > I'm betting that Eduardo's question is simply, "How do I find elements > whose contents begin with "MyNameIs"? and that he's simply using subTagA and > subTagB as examples representing *any* named containing element. > > Howard > > ------------------------------ > *From:* http://xquery.com/mailman/listinfo/talk [mailto:http://xquery.com/mailman/listinfo/talk] *On > Behalf Of *Michael Kay > *Sent:* December 12, 2005 4:41 AM > *To:* 'Elarrat, EFC'; http://xquery.com/mailman/listinfo/talk > *Subject:* RE: Regular Expression search > > > 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: > > //*[starts-with(name(), 'subTag')][starts-with(., 'MyNameIs')] > > Michael Kay > http://www.saxonica.com/ > > ------------------------------ > *From:* http://xquery.com/mailman/listinfo/talk [mailto:http://xquery.com/mailman/listinfo/talk] *On > Behalf Of *Elarrat, EFC > *Sent:* 12 December 2005 12:21 > *To:* http://xquery.com/mailman/listinfo/talk > *Subject:* Regular Expression search > > > Hi everyone, > 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: > > This xml: > > <tagA> > <subTagA>MyNameIsEduardo</subTagA> > </tagA> > <tagB> > <subTagB>MyNameIsElarrat</subTagA> > </tagB> > > 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, > > > Eduardo Elarrat > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://xquery.com/pipermail/talk/attachments/20051212/3d88c9fc/attachment-0001.htm
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|






