Solved

xPath Syntax

Posted on 2013-10-30
2
166 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
2 Comments
 
LVL 35

Accepted Solution

by:
Robert Schutt earned 500 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
When setting up new project requests for our site, one of the most powerful tools our team has available to use is Axure (http://www.axure.com/). It’s a tool for creating software and web prototypes that can function and interact as if it were the a…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now