Monday, 21 January 2019

Using XPATH in RTF: count, starts-with, name functions

https://docs.oracle.com/cd/E80149_01/bip/BIPRD/GUID-4D9FC5FC-5A72-4CE6-919C-A3E0D6E4900C.htm#BIPRD2597

 XPath contains a number of functions on node sets, numbers, and strings; here are a few of them:

  count(elem) counts the number of selected elements
  Example: //section[count(student)=1] selects section with exactly two students children


  name() returns the name of the element
  Example: //*[name()='student'] is the same as //student


  starts-with(arg1arg2) tests if arg1 starts with arg2
  Example: //*[starts-with(name(), 'stu']


  contains(arg1arg2) tests if arg1 contains arg2
  Example: //*[contains(name(), 'tud']

Type

Output
Count elements (Students) in XML

<?count(STUDENT)?>
Name of the Element if exists

<?//*[name()=’ROLL_NO’]?>
Starts-with

<?//*[starts-with(name(), 'ROLL_NO')]?>

OUTPUT IS RETURNED AS BELOW:
Type

Output
Count elements (Students) in XML

3
Name of the Element if exists

1201
Starts-with

1201

check earlier post for xml, save above in rtf file, and output will be shown as shown above

1 comment:

  1. Oracle Apps R12 and Fusion Cloud Self Paced Training Videos Published on Udemy with Live Meeting Support. Please Check https://www.oracleappstechnical.com

    ReplyDelete