need xpath expression for following xml

Best practices, code snippets for common functionality, examples, and guidelines.
ramesh123
Posts: 1
Joined: Sun Oct 20, 2019 8:23 am

need xpath expression for following xml

Post by ramesh123 » Sun Oct 20, 2019 8:35 am

Hi All

i want to get the xpath for attribute value for Runtime and Resolution both highlighted
I have written like this.. but not working

"//Asset/Metadata/AMS[translate(@Asset_Class, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = 'title']/App_Data[@Name='Run_Time']/@Value";

can some one help

thanks in advance.
Ramesh
==============================================================================================================

sample.xml

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ADI>
<Metadata>
<AMS Asset_Class="package" Asset_ID="PRFN3471208100000000" Asset_Name="34712081_v" Creation_Date="2017-03-20" Description="34712081" Product="ADS" Provider="abbc" Provider_ID="abbc.com" Version_Major="1" Version_Minor="0"></AMS>
<App_Data App="ADS" Name="Metadata_Spec_Version" Value="br.1"a></App_Data>
<App_Data App="ADS" Name="Provider_Content_Tier" Value="abcd.com"></App_Data>
</Metadata>
<Asset>
<Metadata>
<AMS Asset_Class="title" Asset_ID="CTLN3471208100000000123456789" Asset_Name="34712081_N-NAME" Creation_Date="2017-03-20" Description="34712081-DESC" Product="ADS" Provider="abbc" Provider_ID="abbc.com" Version_Major="1" Version_Minor="0"></AMS>
<App_Data App="ADS" Name="Type" Value="title"></App_Data>
<App_Data App="ADS" Name="Title" Value="34712081_N"></App_Data>
<App_Data App="ADS" Name="Title_Brief" Value="34712081_N"></App_Data>
<App_Data App="ADS" Name="Summary_Short" Value="34712081_N"></App_Data>
<App_Data App="ADS" Name="Summary_Long" Value="34712081_N"></App_Data>
<App_Data App="ADS" Name="Ads_Video_ID" Value="34712081"></App_Data>
<App_Data App="ADS" Name="Propagation_Priority" Value=""></App_Data>
<App_Data App="ADS" Name="Licensing_Window_Start" Value="2017-03-20T00:00:00"></App_Data>
<App_Data App="ADS" Name="Licensing_Window_End" Value="2027-03-18T23:59:59"></App_Data>
<App_Data App="ADS" Name="Preview_Period" Value="0"></App_Data>
<App_Data App="ADS" Name="Suggested_Price" Value="0.00"></App_Data>
<App_Data App="ADS" Name="Ad_ID" Value="34712081"></App_Data>
<App_Data App="ADS" Name="Asset_Missing_Flag" Value="false"></App_Data>
<App_Data App="ADS" Name="Variant_Spot_ID" Value="34712081_N"></App_Data>
<App_Data App="ADS" Name="Variant_Priority" Value="1.0"></App_Data>
<App_Data App="ADS" Name="Spot_ID" Value="34712081_N"></App_Data>
<App_Data App="ADS" Name="Priority" Value="1.0"></App_Data>
<App_Data App="MOD" Name="Run_Time" Value="00:00:30"></App_Data>
<App_Data App="MOD" Name="MasterSourceID" Value="34712081"></App_Data>
</Metadata>
<Asset>
<Metadata>
<AMS Asset_Class="movie" Asset_ID="CMLN3471208100000000" Asset_Name="34712081" Creation_Date="2017-03-20" Description="34712081" Product="ADS" Provider="abbc" Provider_ID="abbc.com" Version_Major="1" Version_Minor="0"></AMS>
<App_Data App="ADS" Name="Type" Value="movie"></App_Data>
<App_Data App="ADS" Name="Ads_Video_ID" Value="34712081"></App_Data>
<App_Data App="ADS" Name="Content_File_Name" Value="34712081_N.mpg"></App_Data>
<App_Data App="ADS" Name="Copy_Protection" Value="N"></App_Data>
<App_Data App="ADS" Name="Splicing_Enabled" Value="N"></App_Data>
<App_Data App="ADS" Name="Advertise_Enabled" Value="N"></App_Data>
<App_Data App="ADS" Name="Spot_ID" Value="34712081_N"></App_Data>
<App_Data App="ADS" Name="Variant_Spot_ID" Value="34712081_N"></App_Data>
<App_Data App="ADS" Name="Codec" Value="MPEG2"></App_Data>
<App_Data App="ADS" Name="Bit_Rate" Value="3771211"></App_Data>
<App_Data App="ADS" Name="Screen_Format" Value="4:3"></App_Data>
<App_Data App="ADS" Name="Frame_Rate" Value="30"></App_Data>
<App_Data App="ADS" Name="Content_FileSize" Value="14164672"></App_Data>
<App_Data App="ADS" Name="Resolution" Value="480i"></App_Data>
<App_Data App="ADS" Name="Languages" Value="en"></App_Data>
<App_Data App="ADS" Name="Audio_Type" Value="AC-3"></App_Data>
<App_Data App="ADS" Name="Frames" Value="914"></App_Data>
<App_Data App="MOD" Name="HDContent" Value="N"></App_Data>
</Metadata>
<Content Value="34712081_N.mpg"></Content>
</Asset>
</Asset>
</ADI>


==============================================================================================================

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 5256
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: need xpath expression for following xml

Post by odklizec » Mon Oct 21, 2019 11:50 am

Hi,

Please upload a Ranorex snapshot of the UI you are working with. The XML sample you posted is not runnable. Anyway, there is no such a thing like 'translate' in Ranorex xpath. Please keep in mind, that Ranorex does not implementation 100% of xpath definition.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration