<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>GeeKs Blogging @ dotCOM &#187; XML</title>
	<atom:link href="http://geeksbloggingat.com/topics/xml/feed/" rel="self" type="application/rss+xml" />
	<link>http://geeksbloggingat.com</link>
	<description>Let&#039;s share...</description>
	<lastBuildDate>Tue, 30 Aug 2011 21:29:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>XPath Expressions in XML &#8211; Part I</title>
		<link>http://geeksbloggingat.com/2009/06/03/xpath-expressions-in-xml-part-1/</link>
		<comments>http://geeksbloggingat.com/2009/06/03/xpath-expressions-in-xml-part-1/#comments</comments>
		<pubDate>Wed, 03 Jun 2009 05:28:21 +0000</pubDate>
		<dc:creator>Nitin Jain</dc:creator>
				<category><![CDATA[EAI]]></category>
		<category><![CDATA[Siebel]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[workflows]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://geeksbloggingat.com/?p=410</guid>
		<description><![CDATA[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. [...]


<b>Related posts:<b><ol><li><a href='http://geeksbloggingat.com/2009/08/12/siebel-left-right-and-from-the-middle/' rel='bookmark' title='Permanent Link: Siebel &#8211; Left, Right and from the Middle'>Siebel &#8211; Left, Right and from the Middle</a> <small>Extracting a sub string from a lengthy string in Siebel....</small></li>
<li><a href='http://geeksbloggingat.com/2009/05/31/siebel-fins-industry-xml-query-service/' rel='bookmark' title='Permanent Link: Siebel &#8211; FINS Industry XML Query Service'>Siebel &#8211; FINS Industry XML Query Service</a> <small>&#8220;Extracting values from a tag deep down in the Hierarchy.&#8221;...</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>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:<br />
<a href="http://geeksbloggingat.com/2009/04/30/a-meeting-with-siebel-eai/" target="_blank">A meeting with Siebel EAI</a><br />
<a href="http://geeksbloggingat.com/2009/05/31/siebel-fins-industry-xml-query-service/" target="_blank">FINS Industry XML Query Service</a></p>
<p>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.</p>
<p>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.</p>
<p><span id="more-410"></span>&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;UTF-8&#8243;?&gt;<br />
&lt;snackbar&gt;<br />
&nbsp;&nbsp;&lt;fastfood&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;name id=&#8221;10&#8243;&gt;burger&lt;/name&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;price&gt;10&lt;/price&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;calories&gt;1000&lt;/calories&gt;<br />
&nbsp;&nbsp;&lt;/fastfood&gt;<br />
&nbsp;&nbsp;&lt;drink&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;name id=&#8221;20&#8243;&gt;pepsi&lt;/name&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;price&gt;5&lt;/price&gt;<br />
&nbsp;&nbsp;&lt;/drink&gt;<br />
&lt;/snackbar&gt;</p>
<p>Following is the terminology that I will be using:<br />
roottag:                                snackbar<br />
childtag:                               fastfood<br />
grandchildtag:                        name, price<br />
attribute:                              id (this is the attribute of the grandchild element in the XML)</p>
<p>The line on the top (&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;UTF-8&#8243;?&gt;) 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.</p>
<p>Following are some of the common XPath expressions:<br />
/     forward slash &#8211; used to differentiate between parent and child tags one level deep<br />
//    two forward slashes &#8211; indicate searches anywhere in the XML, typically more than one level deep<br />
./    indicates the currect XML document passed an input.<br />
.//   indicates the need to search multiple levels deep in the document<br />
@     indicates the attribute to a particular tag<br />
*     wildcard character to match any tag/element in the XML</p>
<p>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:<br />
./snackbar/fastfood/name</p>
<p>Similarly, for getting the price of &#8216;pepsi&#8217;, I would write:<br />
./snackbar/drink/price</p>
<p>&#8216;Calories&#8217; tag appears just once in the structure, so I can directly use double slashes to retrieve the value &#8217;1000&#8242;:<br />
.//calories</p>
<p>To retrieve the value of the attribute for the name &#8216;pepsi&#8217;, I could use:<br />
./snackbar/drink/name/@id</p>
<p>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, &#8216; &#8216;.</p>
<p>There is more to this. However, what I have covered above are the only ones I have seen working in Siebel successfully.<br />
I have split this blog into parts because of the length. Part II of this article will follow.<!--subscribe2--></p>


<p><b>Related posts:<b><ol><li><a href='http://geeksbloggingat.com/2009/08/12/siebel-left-right-and-from-the-middle/' rel='bookmark' title='Permanent Link: Siebel &#8211; Left, Right and from the Middle'>Siebel &#8211; Left, Right and from the Middle</a> <small>Extracting a sub string from a lengthy string in Siebel....</small></li>
<li><a href='http://geeksbloggingat.com/2009/05/31/siebel-fins-industry-xml-query-service/' rel='bookmark' title='Permanent Link: Siebel &#8211; FINS Industry XML Query Service'>Siebel &#8211; FINS Industry XML Query Service</a> <small>&#8220;Extracting values from a tag deep down in the Hierarchy.&#8221;...</small></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://geeksbloggingat.com/2009/06/03/xpath-expressions-in-xml-part-1/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

