DOM XPath pattern matching

Discussion in 'XML' started by Hardy Merrill, May 12, 2004.

  1. 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
     
    Hardy Merrill, May 12, 2004
    #1
    1. Advertisements

  2. 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/
     
    Martin Honnen, May 12, 2004
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Marvin_123456

    "Memory leak" in javax.xml.xpath.XPath

    Marvin_123456, Jul 29, 2005, in forum: Java
    Replies:
    4
    Views:
    2,144
    jan V
    Jul 29, 2005
  2. ahogue at theory dot lcs dot mit dot edu

    XPath subtree pattern matching

    ahogue at theory dot lcs dot mit dot edu, Jul 28, 2003, in forum: XML
    Replies:
    2
    Views:
    1,301
    Dimitre Novatchev
    Jul 29, 2003
  3. malc

    xpath pattern matching

    malc, Nov 23, 2005, in forum: XML
    Replies:
    1
    Views:
    3,792
    Richard Tobin
    Nov 23, 2005
  4. Marc Bissonnette

    Pattern matching : not matching problem

    Marc Bissonnette, Jan 8, 2004, in forum: Perl Misc
    Replies:
    9
    Views:
    368
    Marc Bissonnette
    Jan 13, 2004
  5. Bobby Chamness
    Replies:
    2
    Views:
    400
    Xicheng Jia
    May 3, 2007
Loading...

Share This Page