GeeKs Blogging @ dotCOM

Let's share…
  • Home
  • About
  • Contribute
  • How To – FAQs
  • Disclaimer
  • Terms & Conditions
3 Jun 2009

XPath Expressions in XML – Part I

by Nitin Jain


This post has a broad focus, not just Siebel CRM. I have briefly alluded to the XML structures in EAI in some of my previous posts:
A meeting with Siebel EAI
FINS Industry XML Query Service

One of the interesting things that came out of the feedback was parsing the XML and the XPath expressions. This is exactly what I will be covering in my blog post today.

The XPath defines the path, or the way that you parse/read/traverse through an XML. The concept is generic in nature. However, Siebel in itself has some limitations in the way that it handles these expressions. I will try to cover both these scenarios here. I will take the following small XML Snippet as an example for better understanding of the same. One of the best ways to understanding this is to refer this structure of the XML is a popular XML Editor like Internet Explorer, Oxygen Editor, Editplus, Altova XML Spy (I like this the best), or any other supported browser.

<?xml version=”1.0″ encoding=”UTF-8″?>
<snackbar>
  <fastfood>
    <name id=”10″>burger</name>
    <price>10</price>
    <calories>1000</calories>
  </fastfood>
  <drink>
    <name id=”20″>pepsi</name>
    <price>5</price>
  </drink>
</snackbar>

Following is the terminology that I will be using:
roottag:                                snackbar
childtag:                               fastfood
grandchildtag:                  name, price
attribute:                             id (this is the attribute of the grandchild element in the XML)

The line on the top (<?xml version=”1.0″ encoding=”UTF-8″?>) defines that the structure is of an XML, and helps the browser parse it. One of the best ways to validate a valid XML is to try and open it in a web browser like Internet Explorer. In case of any discrepancies, the document will throw an error and will not open in the Browser.

Following are some of the common XPath expressions:
/     forward slash – used to differentiate between parent and child tags one level deep
//    two forward slashes – indicate searches anywhere in the XML, typically more than one level deep
./    indicates the currect XML document passed an input.
.//   indicates the need to search multiple levels deep in the document
@     indicates the attribute to a particular tag
*     wildcard character to match any tag/element in the XML

Using the above table, if for eg. I need to retrieve the value in the name tag for burger object, I would build the expression as:
./snackbar/fastfood/name

Similarly, for getting the price of ‘pepsi’, I would write:
./snackbar/drink/price

‘Calories’ tag appears just once in the structure, so I can directly use double slashes to retrieve the value ’1000′:
.//calories

To retrieve the value of the attribute for the name ‘pepsi’, I could use:
./snackbar/drink/name/@id

Note: It has been noted that in case a particular tag does not have a value, instead of returning NULL, in some cases Siebel returns the whitespace character, ‘ ‘.

There is more to this. However, what I have covered above are the only ones I have seen working in Siebel successfully.
I have split this blog into parts because of the length. Part II of this article will follow.



Related posts:

  1. Siebel – Left, Right and from the Middle Extracting a sub string from a lengthy string in Siebel....
  2. Siebel – FINS Industry XML Query Service “Extracting values from a tag deep down in the Hierarchy.”...

Tags: Siebel, Tutorials, workflows, XML



For regular updates, enter your email address below. We don't spam, we don't share with others!




This entry was posted on Wednesday, June 3rd, 2009 at 10:58 AM and is filed under EAI. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

4 Responses to “XPath Expressions in XML – Part I”

  1. Vijay says:
    August 25, 2009 at 2:30 PM

    Its really a different way to minimize the code to improve the siebel performance.Is there any way that we can get the XPath notations from LOVs and gets the tag value from the XML file.

    Thankyou,
    Vijay E

  2. Nitin Jain says:
    August 25, 2009 at 5:18 PM

    Hi Vijay,

    Thanks for your comments.
    Yes, I guess that is possible. In that case, instead of putting the value directly in the Input Argument, you would need to do us LookUpValue() in the Workflow, and get the value from the corresponding LOV.

    Let me know if this works for you.

  3. yp says:
    October 5, 2009 at 11:15 AM

    i have property set look like (in the watch window of wf simulate) :
    -PS:ListOfBc
    – PS:Bc
    PS:BcName: Service Request
    PS:Search:[Status]=Open
    – PS:Bc
    PS:BcName:Action
    PS:Search:[Type]=Debit

    when I write .//[BcName] I get Service Reques, what i have to to get the next BcName?

    Thank you
    Yirat

  4. Nitin Jain says:
    October 7, 2009 at 12:47 AM

    Hi Yirat,

    I guess this is a typical problem that all of us face with the XPath expressions. I see that in your example property set, you have multiple sets of elements with the parent tag as “BC”. Since there is no way to pass through to the second child set even if you use the expanded dot notation, I guess you cannot do it through the XPath expressions.

    You will have to use typical XML parsing methods of GetChild(n), GetProperty() combinations etc. This will have to be Custom Script.

Leave a Reply

Click here to cancel reply.


« Siebel EIM – Custom column mapping
Oracle Fusion Middleware 11g announced »



  • Admin Controls

    • Log in
  • Talk to us

    • Bouquets, brickbats, suggestions, complaints?

    • Click here...
  • Authorships

    • We are currently looking out for active authors. Are you willing to contribute?

    • Please click here

    • Everyone's invited..
  • Subscribe by Email


    • For regular updates, enter your email address below. We don't spam, we don't share with others!

  • Sponsors

  • Subscribe

    • Entries (RSS)
    • Comments (RSS)
  • Siebel Bookshelf

  • Daily Dilbert

    •          
  • Categories

    • Admin Notifications (9)
    • Business Intelligence (2)
      • Actuate (2)
    • CRM (115)
      • CRM News (6)
      • Sage Software / ACT! (1)
      • Salesforce.com (2)
      • Siebel CRM (103)
    • EAI (2)
    • Events (1)
    • FUN 'n' FROLIC (6)
    • Hot Technologies (7)
    • IT News (47)
    • Meet the Author (9)
    • ORACLE (14)
      • Database (2)
      • Oracle Fusion Applications Stack (8)
    • Product Demostrations (5)
    • Uncategorized (4)
  • Tag Cloud

    Admin Admin Notifications Applet Author Introductions Business Component Calculated Function Certification CFG file Client Configuration Critique CRM Database Debugging EAI EIM eScript Fundamentals Fusion Middleware Google IT News License Login Microsoft ORACLE Oracle Fusion Applications Performance problems Product Defect Product Demostrations Salesforce Scriptless solutions Security Server Siebel Siebel Secrets SOA Tips Tools Tricks Tutorials Upgrade User Property Workarounds workflows



  • Archives

    • August 2011
    • July 2011
    • June 2011
    • May 2011
    • April 2011
    • November 2010
    • August 2010
    • May 2010
    • April 2010
    • March 2010
    • February 2010
    • January 2010
    • December 2009
    • November 2009
    • October 2009
    • September 2009
    • August 2009
    • July 2009
    • June 2009
    • May 2009
    • April 2009
    • March 2009
  • Authors

    • Ankit Bhardwaj
    • Ashish Kaul
    • brijesh
    • Himanshu Bajpai
    • Madhvi Arora
    • nanpats
    • Nitin Jain
    • Prachi Sharma
    • Renuka Ankam
    • Vikas Luthra
  • Administrators

    • geeksblogging@gmail.com
    • admin@geeksbloggingat.com
  • Sponsors

Fresh Ideas

  • Login Failed in Dedicated Web Client : MVF Issue
  • Oracle Fusion Applications price list
  • Research to Development - Fusion Apps Series
  • Oracle ACE Program
  • HCM user Experience through UI - Fusion Apps series
  • "Managing Oracle Fusion Applications"
  • Microsoft *previews* Windows 8 - Part 2 now available !!
  • Let's upgrade Siebel CRM to Fusion Apps "right now" !!
  • Ness Technologies bought out by Citigroup Unit
  • Oracle #1 CRM Applications vendor ??

Just Said

  • Amit Sharma on Siebel – Installer hangs midway
  • Khadijah Mosinski on Salesforce.com not upto the mark?
  • Hamre319 on Highrise Customer Relationship Management
  • Nitin Jain on “Managing Oracle Fusion Applications”
  • zama racha on “Managing Oracle Fusion Applications”
  • Nishant Aggarwal on Siebel – License keys don’t work / are invalid
  • Nitin Jain on Siebel – SIA BC Utility Service – Invoke BC Method
  • Pedro Garcia on Siebel – SIA BC Utility Service – Invoke BC Method
  • Nitin Jain on “Managing Oracle Fusion Applications”
  • Nitin Jain on Microsoft *previews* Windows 8 – Part 2 now available !!

Most Commented

  • Siebel - SIA BC Utility Service - Loop multiple records
  • Siebel - Installer hangs midway
  • Siebel - Adding License Keys to Sample
  • Siebel - Popup Update Only
  • Siebel - Reading data directly from Siebel SRF
  • Siebel - Automatic User Logout
  • Siebel - EAI Queue - Usage
  • Siebel - Looping multiple records - Update records
  • Siebel - SIS OM PMT Service
  • Siebel Tools hangs when checking out objects

Old Favourites

  • Highrise Customer Relationship Management
  • Siebel - Autosave Opportunity data - Sample Code
  • Siebel - Autosave Opportunity data - The concept
  • Renuka Ankam
  • Siebel - Merge Records - Checklist
  • Siebel - Fetch Active view properties - III
  • Oracle 11g Certification coming soon
  • Siebel - Fetch Active view properties - II
  • Siebel - Fetch Active view properties
  • Siebel - Automating Merge Records by script - II

If you also want to write on GeeksBlogging@dotCOM, click here. Area of Specialization no constraint. Become Famous!


Entries (RSS) and Comments (RSS).