?
Solved

xPath Syntax

Posted on 2013-10-30
2
Medium Priority
?
181 Views
Last Modified: 2013-11-14
Hello,

We have a program that recently allowed us to use Xpath to conditionally set a value to a field

I want to put in an if statement that says If this element contains *VIP* set the value to a text string.  This is what i have currently and the xml which is not working.  The () at start and finish are required

(if //Profile/Traveler/TPA_Extensions/PriorityRemarks[contains(@Text, "*VIP*'')] then "S*UD5 VIP"   else "")

<Profile CreateDateTime="2013-10-03T19:09:42.399Z" UpdateDateTime="2013-10-25T19:50:16.059Z" PrimaryLanguageIDCode="EN-US">
  <TPA_Identity ClientCode="TN" ClientContextCode="MYS" UniqueID="105558622" ProfileTypeCode="TVL" ProfileName="NEVER WILLIAM" ProfileNameModifyIndicator="Y" ProfileDescription="" DomainID="AAAA" ProfileStatusCode="AC"/>
  <Traveler>
    <TPA_Extensions>
      <PriorityRemarks Text="*** VIP ***&amp;#10;other priority remarks...remark type PRIORITY" OrderSequenceNo="1"/>
    </TPA_Extensions>
  </Traveler>
  <Association AssociationID="36812" DomainID="A98A" ClientCode="TN" AssociationDescription="A98A Traveler Profile Template" AssociationName="A98A Traveler Profile" ClientContextCode="MYS" ProfileTypeCode="TVL" CreateDateTime="2013-10-03T19:00:07.312Z" UpdateDateTime="2013-10-25T19:51:24.157Z"/>
</Profile>

any thoughts?
0
Comment
Question by:posae
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 35

Accepted Solution

by:
Robert Schutt earned 2000 total points
ID: 39613551
Without knowing the exact way that particular program handles the 'xpath check' code it's hard to say where the problem is, but 2 general remarks:

1) the check code contains a strange problem concerning the use of 2 single quotes rather than a double quote after the text to check:

[contains(@Text, "*VIP*'')]

Open in new window


2) if the stars (asterix) are meant to be wildcards, leave them out for the contains function to work. If they are meant to be a part of the text literally, note that the example xml has spaces around VIP whereas the check does not:
*** VIP ***

Open in new window

and checking for:
*VIP*

Open in new window

0
 

Author Closing Comment

by:posae
ID: 39647655
Thanks...the quotes were the issue
0

Featured Post

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
The purpose of this video is to demonstrate how to Import and export files in WordPress. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Click on Too…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question