Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > DOM XPath pattern matching

Reply
Thread Tools

DOM XPath pattern matching

 
 
Hardy Merrill
Guest
Posts: n/a
 
      05-12-2004
I have an XML document that has this structure:

<applications>
<application>
<app_name>ABC</app_name>
</application>
<application>
<app_name>DEF</app_name>
</application>
</applications>

I'm wondering if there's a way using XPath and some pattern to find
case *insensitive* matches for a particular app_name??

For example, if I have app_name 'ABC' and I want to determine if there
are any existing nodes that have app_names like 'ABC', or 'Abc', or
'abc', or 'aBC', etc. Is there some version of 'selectSingleNode' with
a pattern that can do that? AFAICT there aren't any case
(in)sensitivity functions in XSL or XPath.

TIA.

Hardy Merrill
 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      05-12-2004


Hardy Merrill wrote:

> I have an XML document that has this structure:
>
> <applications>
> <application>
> <app_name>ABC</app_name>
> </application>
> <application>
> <app_name>DEF</app_name>
> </application>
> </applications>
>
> I'm wondering if there's a way using XPath and some pattern to find
> case *insensitive* matches for a particular app_name??
>
> For example, if I have app_name 'ABC' and I want to determine if there
> are any existing nodes that have app_names like 'ABC', or 'Abc', or
> 'abc', or 'aBC', etc. Is there some version of 'selectSingleNode' with
> a pattern that can do that? AFAICT there aren't any case
> (in)sensitivity functions in XSL or XPath.
>



Use translate(element, 'ABCDEDFHIJKLMNOPQRESTUFWXYZ',
'abcdefghijklmnopqrestuvwxyz')
e.g.

/applications/application['abc' = translate(app_name, 'ABC', 'abc')]
--

Martin Honnen
http://JavaScript.FAQTs.com/

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with Pattern matching. Matching multiple lines from while reading from a file. Bobby Chamness Perl Misc 2 05-03-2007 06:02 PM
xpath pattern matching malc XML 1 11-23-2005 11:49 PM
"Memory leak" in javax.xml.xpath.XPath Marvin_123456 Java 4 07-29-2005 03:49 PM
Pattern matching : not matching problem Marc Bissonnette Perl Misc 9 01-13-2004 05:52 PM
XPath subtree pattern matching ahogue at theory dot lcs dot mit dot edu XML 2 07-29-2003 09:25 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57