Solved

xPath Syntax

Posted on 2013-10-30
2
169 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

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…
Introduction In this tutorial, I'll explain how to create an animated progress meter in a wireframe prototype developed using Axure RP 7.0 - a leading prototyping tool for designing web sites and software. (For more information about Axure and gett…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

773 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