<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress.com" -->
<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/"
	>

<channel>
	<title>xpath &amp;laquo; WordPress.com Tag Feed</title>
	<link>http://en.wordpress.com/tag/xpath/</link>
	<description>Feed of posts on WordPress.com tagged "xpath"</description>
	<pubDate>Sun, 27 Dec 2009 08:21:53 +0000</pubDate>

	<generator>http://en.wordpress.com/tags/</generator>
	<language>en</language>

<item>
<title><![CDATA[.NET XPath queries on XML with a namespace]]></title>
<link>http://roundedcorners.wordpress.com/2009/12/23/net-xpath-queries-on-xml-with-a-namespace/</link>
<pubDate>Wed, 23 Dec 2009 15:27:22 +0000</pubDate>
<dc:creator>Naeem</dc:creator>
<guid>http://roundedcorners.wordpress.com/2009/12/23/net-xpath-queries-on-xml-with-a-namespace/</guid>
<description><![CDATA[A quick one here. Wasn&#8217;t getting any results when running XPath queries on the following Xml: ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>A quick one here. Wasn&#8217;t getting any results when running XPath queries on the following Xml:</p>
<pre>&#60;root xmlns="http://www.tempuri.org/xml/export-0.3/"&#62;
  &#60;page&#62;...&#60;/page&#62;
  &#60;page&#62;...&#60;/page&#62;
  &#60;page&#62;...&#60;/page&#62;
&#60;/root&#62;
Query: "/root/page" or "//page"</pre>
<p>As this xml contains a namespace definition you&#8217;ll need to pass an instance of the XmlNamespaceManager like so&#8230;</p>
<pre>XmlDocument xdDoc = new XmlDocument();
xdDoc.Load("Source.xml");

XmlNamespaceManager xnManager =
 new XmlNamespaceManager(xdDoc.NameTable);
xnManager.AddNamespace("tu",
 "http://www.tempuri.org/xml/export-0.3/");

XmlNode xnRoot = xdDoc.DocumentElement;
XmlNodeList xnlPages = xnRoot.SelectNodes("/root/page", xnManager);

XmlNode xnRoot = xdProfiles.DocumentElement;
XmlNodeList xnlPages = xnRoot.SelectNodes("/root/page", xnManager);
// Assert(xnlPages.Count == 3);</pre>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[The Poor Developer's Object DataStore: Iteration 000]]></title>
<link>http://just3ws.wordpress.com/2009/12/02/the-poor-developers-object-datastore-iteration-000/</link>
<pubDate>Wed, 02 Dec 2009 02:32:10 +0000</pubDate>
<dc:creator>just3ws</dc:creator>
<guid>http://just3ws.wordpress.com/2009/12/02/the-poor-developers-object-datastore-iteration-000/</guid>
<description><![CDATA[This is part zero of a multi-part series. Jump to The Poor Developer&#8217;s Object DataStore: Itera]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><b>This is part zero of a multi-part series. Jump to <a href="http://wp.me/pijpG-7f">The Poor Developer&#8217;s Object DataStore: Iteration 001</a> for the first code drop.</b></p>
<p>What is an object datastore? For an object-oriented developer it&#8217;s as easy to use as a typed collection. No need to build and maintain a complex relational model to simulate the native object functionality. Just create your object, modify it, store it, query for it and delete it. All the complicated work is handled by the object database engine. But let&#8217;s consider a situation where you may want to &#8220;roll your own&#8221; light-weight object datastore. And depending on your situation, it might make sense. <i>CAVEAT: Rule #1 of Software Engineering: If You Can Use A Proven Product Don&#8217;t Write Your Own. They Did It First And They Did It Better.</i> But for the sake of exercise and trying something new let&#8217;s just ignore that rule and keep on going.</p>
<p>Consider the following scenario. You&#8217;re a .NET developer and you&#8217;ve been tasked with creating an archiving system. The system needs to take a snapshot of the data and store it to be queried against and reported on later.</p>
<p>How would you implement this? Would you copy the data structure you&#8217;re looking to archive and pull the data state into there? How do you manage foreign keys? Do you squish the data into a single table? Do you recreate all the tables with annotations to identify the archived records? Now, it&#8217;s a few months later and the original data structure has changed. How do you handle that change in your archiving?</p>
<p>Do you really want to recreate that complex data structure and try to wrangle the data into it and manage it over time? No, neither did I and I think there is a better way. Let&#8217;s consider a new way: an <strong>object datastore</strong>.</p>
<p>Let&#8217;s get this out of the way. Object databases aren&#8217;t just for ninjas although they are often wielded by ninjas. An object database is exactly what it sounds like, a <em>database</em> for your <em>objects</em>. No sql, no tables, no object-relational impedance. Just objects persisted similar to how a relational database allows you to store and persist tabular information offline without all the grief of mapping your object-oriented structure onto a relational model. Instead you create your objects and using the database&#8217;s API you can save and query for your data without worrying about sql or any of that mess. My personal favorite OODBMS (object-oriented database management system) is <a href="http://developer.db4o.com/Resources/">db4o</a>. I recommend downloading and playing around with it to get a feel for how simple it is to use. (If you want to learn more about various types of *DBMS check out the great presentation by Ben Scoffield at WindyCityRails 2009 &#8211; <a href="http://windycityrails.org/videos#3">&#8220;Comics&#8221; is Hard</a>.)</p>
<p>There&#8217;s one catch to using db4o in a closed source or proprietary project. You can either pay to license the product. It&#8217;s not too expensive for bringing into a medium sized project. Or you can release your project under GPL. For the project I was working on, neither option was palatable for our client. Also, I didn&#8217;t want to introduce yet another external dependency that our client would have to manage. Instead I created the simplest possible implementation of an object datastore I could using only native .NET and Microsoft Sql Server functionality.</p>
<p>Continued in <a href="http://wp.me/pijpG-7f">The Poor Developer&#8217;s Object DataStore: Iteration 001</a>.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[XSL introduction and references]]></title>
<link>http://automationbeyond.wordpress.com/2009/11/30/xsl-introduction/</link>
<pubDate>Mon, 30 Nov 2009 12:32:17 +0000</pubDate>
<dc:creator>Albert Gareev</dc:creator>
<guid>http://automationbeyond.wordpress.com/2009/11/30/xsl-introduction/</guid>
<description><![CDATA[Parent page: Service Functions – XML (QTP, VBScript)  What is XSL? The Extensible Stylesheet Languag]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Parent page: <a title="Permanent Link to Service Functions – XML (QTP, VBScript)" rel="bookmark" href="http://automationbeyond.wordpress.com/2009/10/02/service-functions-xml/" target="_blank"><strong>Service Functions – XML (QTP, VBScript)</strong></a> </p>
<p><strong>What is XSL?</strong> The Extensible Stylesheet Language.<br />
An XSL script is a set of transformation instructions used by an engine (often, web browser, but could be any other processing program as well) to produce a new document based on XML input document. The original document remains unchanged.<br />
The output document format can be another XML, HTML, or plane text.</p>
<h4>How XSL could be used in test automation?</h4>
<p><strong><span style="text-decoration:underline;">XML files verification</span></strong></p>
<p>Manual verification of XML file contents and structure is a very tedious job, and only small-sized files could be  tested that way. Implementation of XML parsing script requires time and does remove the need to manually go over comparison logs. Each XML structure to compare will require creation of a separate script.</p>
<p>Having displayed XML-based data records as a structured and color coded tables on a web-page tester can go through a hundreds of records in just a few minutes.</p>
<p><strong>Example. </strong><strong><a href="http://automationbeyond.wordpress.com/2009/12/02/xml-verification-example-xsl-html/" target="_blank">XML verification example</a></strong></p>
<p><strong> </strong></p>
<p><strong><span style="text-decoration:underline;">XML log to Web-page report transformation</span></strong></p>
<p>It&#8217;s very convenient to generate and store execution logs in XML format. That could be Test Execution Logs, <a href="http://automationbeyond.wordpress.com/2009/05/26/vbscript-xml-xsl/" target="_blank">File Comparison</a> Logs, Data Processing Logs, anything. However, XML tree view is not screen or paper friendly. Producing logs directly in HTML format creates extra maintenance issues.</p>
<p>Using XSL scripts allows transforming XML log files into easily viewable, content-rich, navigation-enhanced, and printer-friendly web-pages. Same XML log could be displayed in a variety of forms (detailed, summary, fail reports, etc)  by quickly switching  to different XSL templates.</p>
<p><strong>Example. </strong><strong><a href="http://automationbeyond.wordpress.com/2009/12/03/text-file-compare-report-example-xml-xsl-html/" target="_blank">Text File Compare Report example</a></strong></p>
<p><strong> </strong></p>
<p><strong>Documentation and references.</strong></p>
<p><strong><a href="http://www.dpawson.co.uk/xsl/sect2/sect21.html" target="_blank">XSLT Questions and Answers</a></strong></p>
<p><strong><a href="http://en.wikipedia.org/wiki/XSL_Transformations" target="_blank">XSL Transformations</a> </strong></p>
<p><strong><a href="http://www.washington.edu/computing/training/540b/zz-xsl-2-html.html" target="_blank">Converting XML to HTML using XSL</a></strong></p>
<p><strong><a href="http://www.mulberrytech.com/quickref/index.html" target="_blank">Reference Cards</a></strong></p>
<p><strong> </strong></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[The Poor Developer's Object DataStore : Iteration 001]]></title>
<link>http://just3ws.wordpress.com/2009/11/28/the-poor-developers-object-datastore-iteration-001/</link>
<pubDate>Sat, 28 Nov 2009 16:02:21 +0000</pubDate>
<dc:creator>just3ws</dc:creator>
<guid>http://just3ws.wordpress.com/2009/11/28/the-poor-developers-object-datastore-iteration-001/</guid>
<description><![CDATA[In The Poor Developer&#8217;s Object DataStore : Iteration 000 we proposed a possible motivation for]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>In <a href="http://wp.me/pijpG-7T">The Poor Developer&#8217;s Object DataStore : Iteration 000</a> we proposed a possible motivation for wanting to store complex objects in a database without resorting to creating a complicated relational model.</p>
<p>For our first iteration we need only to be able to create and read the object from the database. It&#8217;s not going to be necessary to update or delete the data at this point. Only store and read. So why bother recreating the original data structure? Why not just query for the data with your ORM of choice and then serialize that result to Xml and store <em>that</em>? If you&#8217;re already using Microsoft Sql Server 2005 or later you&#8217;re already in a very good position as MSSQL provides the Xml datatype which makes storing, querying and retrieving Xml data very<br />
easy and efficient.</p>
<p>If you are using an ORM for your data-access (you *ARE* using an ORM aren&#8217;t you?) then you&#8217;re already halfway there. My original implementation utilized custom objects that implemented an IStorable interface. Basically, I used Linq to Sql to query the data I wanted to archive and mapped the query result to an object that implemented the interface. Using that I could save the object into the datastore in a similar manner to <a href="http://en.wikipedia.org/wiki/Active_record_pattern">Active Record</a>. This was very easy to do.</p>
<pre class="brush: csharp;">
public interface IStorable&#60;T&#62;
{
  string ConnectionString { get; set; }
  string Serialize();
  T Deserialize(string xml);
  XmlSerializer CreateSerializer();
  int Save();
}
</pre>
<p>So I could load up my data into a custom object, set the connectionstring and then automatically save it into the database.</p>
<pre class="brush: csharp;">
//a sample unit test demonstrating usage of the IStorable object.
public void TestStoreFoo()
{
  var foo = new Foo();
  foo.Id = 100;
  foo.Name = &#34;Penelope&#34;;
  foo.ConnectionString = &#34;__YourConnectionString__&#34;
  var objectId = foo.Save();
  Assert.That(objectId == 1);
}
</pre>
<p>So here&#8217;s the implementation. If you wish to grab the source code don&#8217;t try to cut and paste it from here. All the source code for this blog post can be browsed and downloaded from <a href="http://github.com/just3ws">GitHub</a>.</p>
<p><a href="http://github.com/just3ws/PoorDevsObjectDataStore/tree/master/src/PoorDevsObjectDataStore.Examples/Iteration001/">Source Code for Iteration 001</a></p>
<p>First we must implement the IStorable interface. The interface must take the implementing type as it&#8217;s generic argument. This is because we&#8217;re providing functionality for the object to serialize and store itself.</p>
<pre class="brush: csharp;">
public class Foo : IStorable&#60;Foo&#62;
{
</pre>
<p>The Foo.Id and Foo.Name are our data. They are not part of the IStorable implementation.</p>
<pre class="brush: csharp;">
  public int Id { get; set; }
  public string Name { get; set; }
</pre>
<p>We need to provide the connectionstring to the database where the objects are going to be stored.</p>
<pre class="brush: csharp;">
  public string ConnectionString { get; set; }
</pre>
<p>Now we&#8217;re getting to the fun part. We will use an in-memory stream to serialize this instance of the Foo object and then write it to a string.</p>
<pre class="brush: csharp;">
  public string Serialize()
  {
    string output;
    using(var buffer = new MemoryStream())
    {
      new XmlSerializer(typeof(Foo)).Serialize(buffer, this);
      buffer.Position = 0;
      output = new StreamReader(buffer).ReadToEnd();
    }
    return output;
  }
</pre>
<p>The deserialize method takes the xml as a string from a previous serialization and will attempt to convert it back into a Foo instance.</p>
<pre class="brush: csharp;">
  public Foo Deserialize(string xml)
  {
    return (Foo)new XmlSerializer(typeof(Foo)).Deserialize(new StringReader(xml));
  }
</pre>
<p>In order to serialize a type we must create a typed instance of a serializer object. Here we&#8217;re just creating a Foo serializer and setting the error event handlers to output it&#8217;s errors to standard output.</p>
<pre class="brush: csharp;">
  public XmlSerializer CreateSerializer()
  {
    var serializer = new XmlSerializer(typeof(Foo));
    //simply output error messages for types that we don't know how to serialize.
    serializer.UnknownAttribute += ((sender, e)=&#62;Console.Out.WriteLine(e));
    serializer.UnknownElement += ((sender, e)=&#62;Console.Out.WriteLine(e));
    return serializer;
  }
</pre>
<p>The save method is where we will kick off the work. We take this current instance and apply the Serialize() method to itself which converts the instance to a xml string. We also capture the fully-qualified name of the object type, both the namespace and the type name. This will be important when we are ready to pull the object back out of the datastore.</p>
<p>Here I&#8217;m using a Linq to Sql context, you may use any ORM as long as it supports the Microsoft Sql Server Xml datatype.</p>
<pre class="brush: csharp;">
  public int Save()
  {
    using(var context = new Example001DataContext(this.ConnectionString))
    {
      var entity = new Example001ObjectDataStore {
        Serialized = XElement.Parse(this.Serialize()),
        FullyQualifiedTypeName = this.GetType().FullName
      };
      context.Example001ObjectDataStores.InsertOnSubmit(entity);
      context.SubmitChanges();
      return entity.Id;
    }
  }
}
</pre>
<p>The underlying data table is very simple. Only a single table with a field for storing the serialized xml data and a field for storing the fully qualified name of the object.<br />
<div id="attachment_480" class="wp-caption aligncenter" style="width: 433px"><a href="http://just3ws.wordpress.com/files/2009/11/iteration_001_table_definition.png"><img src="http://just3ws.wordpress.com/files/2009/11/example_001.png" alt="The Poor Developer&#39;s Object DataStore: Iteration 001, diagram" title="poordevsobjectdatastore_iteration001_example_001_table" width="423" height="180" class="size-full wp-image-480" /></a><p class="wp-caption-text">The Iteration 001 Object DataStore Table Definition</p></div></p>
<p>In this post we&#8217;ve got the ball rolling for storing objects into some some table. We can create an object that knows how to write itself into a database without requiring the creation of an elaborate data structure in order to just to simulate the object structure.</p>
<p>Next post we&#8217;ll cover how to retrieve the data from the table and convert it back into an instance of the persisted type. Next post we&#8217;ll look at how we can really test the functionality and behavior of the system. And begin to explore how to abstract the datastore to support arbitrary objects (with some minor restrictions.)</p>
<p>The source code for this project is hosted on <a href="http://github.com/just3ws">GitHub </a>and can be downloaded from <a href="http://github.com/just3ws/PoorDevsObjectDataStore/tree/master/src/PoorDevsObjectDataStore.Examples/Iteration001/">here</a>.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[SCRIBEFIRELl0UJxpmR2SCRIBEFIRE]]></title>
<link>http://just3ws.wordpress.com/2009/11/28/scribefirell0ujxpmr2scribefire/</link>
<pubDate>Sat, 28 Nov 2009 01:58:45 +0000</pubDate>
<dc:creator>just3ws</dc:creator>
<guid>http://just3ws.wordpress.com/2009/11/28/scribefirell0ujxpmr2scribefire/</guid>
<description><![CDATA[SCRIBEFIREol26UBNsSCRIBEFIRE]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>SCRIBEFIREol26UBNsSCRIBEFIRE</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[XPath introduction and references]]></title>
<link>http://automationbeyond.wordpress.com/2009/11/23/xpath-1/</link>
<pubDate>Mon, 23 Nov 2009 21:00:59 +0000</pubDate>
<dc:creator>Albert Gareev</dc:creator>
<guid>http://automationbeyond.wordpress.com/2009/11/23/xpath-1/</guid>
<description><![CDATA[Parent page: Service Functions – XML (QTP, VBScript)  Note. Although there could be no &#8220;reusab]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Parent page: <a title="Permanent Link to Service Functions – XML (QTP, VBScript)" rel="bookmark" href="http://automationbeyond.wordpress.com/2009/10/02/service-functions-xml/" target="_blank"><strong>Service Functions – XML (QTP, VBScript)</strong></a> </p>
<p><strong>Note.</strong> Although there could be no &#8220;reusable function&#8221; that would construct XPath for you, I store current post under &#8220;XML Service Functions&#8221; category, as it&#8217;s closely related to it. XPath is fairly simple to learn and very powerful in use. <br />
You can use free <a href="http://www.organicbit.com/Posts/2007-02-XPathDesigner.html" target="_blank">XPath Designer Tool</a> to validate queries you constructed.</p>
<p><strong>What is XPath?</strong> The each element in XML tree has its own unique address.<br />
The XPath expressions provide the ability to navigate around the tree, selecting elements (groups of nodes, single nodes, attributes, text values, etc.) by a variety of conditions.</p>
<p><strong>What does it mean?</strong> You can address any XML tree element without looping through the tree, i.e. as you use array[index] notation to get an element of the array, for XML you would use XML[XPath].</p>
<p><strong>How basic XPath syntax looks like?</strong> You will see that it is very similar to a disk folder/file addressing, as it&#8217;s a tree structure too.<br />
For example, filepath &#8220;c:\documents\personal\pictures\1.jpg&#8221;  in XML-XPath notation would look like &#8220;./documents/personal/pictures/picture[1]&#8220;.</p>
<p><strong>What are the differences?</strong><br />
If we can address only one file with a single pathstring, in XML we can address a collection of elements with a single pathstring. If in any folder there could be no duplicated filenames, in XML it&#8217;s allowed: elements will be referred by index. <br />
If we can address an element of an array only by index value, in XML we can address elements by index value or by element value. If with arrays all indexing is absolute, in XML it could be relative.</p>
<p><strong>Examples.</strong><br />
Get a collection of book items in a library XML structure. Xpath = &#8220;./library/book&#8221;.<br />
Get first book in the collection. Xpath = &#8220;./library/book[1]&#8220;.<br />
Get a collection of book items written by James Bach. Xpath = &#8220;<span style="font-size:x-small;">descendant::book[author/@firstname='James' and author/@lastname='Bach']</span>&#8220;.</p>
<p><strong>Documentation and references.</strong></p>
<p><strong><a href="http://www.w3.org/TR/xpath" target="_blank">W3C XML Path Language</a></strong></p>
<p><strong><a href="http://www.w3schools.com/XPath/xpath_intro.asp" target="_blank">W3Schools XPath Introduction</a></strong></p>
<p><strong><a href="http://www.developerfusion.com/samplechapter/89/using-xml-queries-and-transformations/1/" target="_blank">Using XML Queries and Transformations</a></strong></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Selenium testing best practices]]></title>
<link>http://geoffreyducharme.wordpress.com/2009/11/17/selenium-testing-best-practices/</link>
<pubDate>Tue, 17 Nov 2009 18:08:12 +0000</pubDate>
<dc:creator>geoffreyducharme</dc:creator>
<guid>http://geoffreyducharme.wordpress.com/2009/11/17/selenium-testing-best-practices/</guid>
<description><![CDATA[&nbsp; During the last two months, I&#8217;ve been doing Selenium development. I&#8217;ve been somew]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>&#160;</p>
<p>During the last two months, I&#8217;ve been doing Selenium development. I&#8217;ve been somewhat mixed in feelings about the Selenium platform.</p>
<p><strong>Prefer CSS3 selectors</strong></p>
<p>In theory, Selenium makes it fast and easy to create new tests. With a Firefox plugin available, practically anyone can take a page and record a test for it.</p>
<p>In practice, however, there is catch. Most of the selectors of Selenium, when recorded using the Firefox plugin use Xpath to operate their magic. While using an Xpath is not a problem in itself, it is a technology with which fewer developers are familiar, then say, CSS. More aggravating to me is that the Xpath that is implemented is incomplete. I haven&#8217;t checked thoroughly on what the differences are between Selenium&#8217;s Xpath and the W3 specifications, but there are enough that I will often write a valid Xpath query with another Firefox plugin called Xpath Checker that fails with Selenium. The solution often is to rewrite the selector using CSS3, which seems to work better in most circumstances.  The thing that saves Xpath is its great flexibility when it comes to, say, selecting a tag based on a value somewhere else on the page.</p>
<p><strong>Get GIGO with it</strong></p>
<p>Not all the problems we&#8217;ve been having with Selenium come from it.</p>
<p>I&#8217;ve spent a week or two to get a meaningful, representative data set, from which to operate Selenium. The, of course crucially important in order to get non GIGO results.</p>
<p>The problem in our case is that it is not something that had been done since the project inception. While migrations help a great deal with the structure and fixtures help with seeding some values, our system is complex enough that it is not realistic to simply rely on fixtures.</p>
<p>The first approach was to take an existing data dump from a live system. While this was quite workable, it was also hard to maintain the test data, the Selenium tests and the application up to date and sufficiently seperate from one another.</p>
<p>The second approach we took was to include fixtures on top of the dump. While this was convenient to quickly resolve issues with a particular test, we rapidly found out that this caused unit and functional test which already relied on certain value to fail.</p>
<p>The third approach was to start from scratch and completely rebuild the database, in order to have a perfect blank, or master from which to evolve. In practice, the system&#8217;s data was complex enough that when there was missing data, it was often difficult and time consuming to isolate the origin of the error and correct it.</p>
<p>The current approach I feel is the best one so far. It is simply to take the previous, start-from-scratch approach and automate it entirely, thereby introducing better traceability into the test data process and shortening the time required to fix initial data errors.</p>
<p>The lessons I take from this are:</p>
<ul>
<li>Since you&#8217;ll be agile and testing, plan your data creation strategy from the beginning.</li>
<li>Make sure that the data creation process is as automated as possible, so that when large changes to the application come about, it is possible to quickly make Selenium follow along</li>
<li>Involve domain experts. Often, creating a blank slate of the application can be daunting, especially in a large system that has evolved without such a system. Domain experts are your best bet into what need to be included in the creation of initial data.</li>
<li>Maintain the strategy. While it would be nice to have tests on the data that the strategy creates, this is a bit of a chicken and the egg problem. So, instead of testing directly the data creation strategy, reexamine it in thought when one of its dependent test fails.</li>
</ul>
<p>You&#8217;ll probably want to have your strategy using Rake or Raven depending on your platform and preferences. Even using Rake on DotNet and learning a new tool is better then relying on manual efforts to create that valuable data.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[QTP-XML service functions (6) – CreateChildElementByName]]></title>
<link>http://automationbeyond.wordpress.com/2009/11/14/qtp-xml-service-functions-6/</link>
<pubDate>Sat, 14 Nov 2009 12:34:22 +0000</pubDate>
<dc:creator>Albert Gareev</dc:creator>
<guid>http://automationbeyond.wordpress.com/2009/11/14/qtp-xml-service-functions-6/</guid>
<description><![CDATA[Parent page: Service Functions – XML (QTP, VBScript) Description Uses .AddChildElementByName method ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Parent page: <a title="Permanent Link to Service Functions – XML (QTP, VBScript)" rel="bookmark" href="http://automationbeyond.wordpress.com/2009/10/02/service-functions-xml/" target="_blank"><strong>Service Functions – XML (QTP, VBScript)</strong></a></p>
<p><span style="text-decoration:underline;"><strong>Description</strong></span></p>
<p>Uses .AddChildElementByName method to create a child XML node, then returns reference to the newly created object. If Parent XML node is not defined returns &#8220;Nothing&#8221;.</p>
<pre class="brush: vb;">

Public Function CreateChildElementByName(ByRef objXMLParent, ByVal sTagName, ByVal sInnerText)
 Dim objColl

 If objXMLParent is Nothing Then
  Set CreateChildElementByName = Nothing
  Exit Function
 End If

 objXMLParent.AddChildElementByName sTagName, sInnerText

 Set objColl = objXMLParent.ChildElementsByPath(“./”&#38;sTagName)
 If objColl.Count &#62;0 Then
  Set CreateChildElementByName = objColl.Item(objColl.Count)
 Else
  Set CreateChildElementByName = Nothing
 End If
 
End Function
</pre>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Dynamic Xpath function with SqlClr in SQL Server ]]></title>
<link>http://adglopez.wordpress.com/2009/11/14/xpath-function-to-xml-type-with-sqlclr-in-sql-server/</link>
<pubDate>Sat, 14 Nov 2009 00:46:03 +0000</pubDate>
<dc:creator>adglopez</dc:creator>
<guid>http://adglopez.wordpress.com/2009/11/14/xpath-function-to-xml-type-with-sqlclr-in-sql-server/</guid>
<description><![CDATA[In the previous post i commented an approach to perform queries with dynamic xpath. It was useful in]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>In the previous <a href="http://adglopez.wordpress.com/2009/11/13/dynamic-xpath-using-xml-datatype-in-sql-server/">post</a> i commented an approach to perform queries with dynamic xpath. It was useful initially to determine the result in a stand alone sql sentence (e.g. exec spXpah @xml, @xpath, @result output), but if we need to use for example in a where clause we&#8217;ll need a function. Since the previous approach uses sp_executesql it not suites well to Sql Server.</p>
<p>So i decided to use SqlClr to create the function:</p>
<p>To create the assembly just add a new SqlClr C# Project, add a user defined function and paste this code:</p>
<p>using System;</p>
<p>using System.Data;</p>
<p>using System.Data.SqlClient;</p>
<p>using System.Data.SqlTypes;</p>
<p>using Microsoft.SqlServer.Server;</p>
<p>using System.Xml;</p>
<p>using System.Xml.XPath;</p>
<p>using System.IO;</p>
<p>using System.Text;</p>
<p>public partial class UserDefinedFunctions</p>
<p>{</p>
<p>[Microsoft.SqlServer.Server.SqlFunction]</p>
<p>public static SqlString XPath(SqlXml message, string xpath)</p>
<p>{</p>
<p>if (message.IsNull &#124;&#124; string.IsNullOrEmpty(xpath))</p>
<p>return string.Empty;</p>
<p>XPathDocument doc = new XPathDocument(new StringReader(message.Value));</p>
<p>XPathNavigator nav = doc.CreateNavigator();</p>
<p>XPathExpression expr = nav.Compile(xpath);</p>
<p>string result = string.Empty;</p>
<p>switch (expr.ReturnType)</p>
<p>{</p>
<p>case XPathResultType.Boolean:</p>
<p>case XPathResultType.Number:</p>
<p>case XPathResultType.String:</p>
<p>result = nav.Evaluate(expr).ToString();</p>
<p>break;</p>
<p>case XPathResultType.NodeSet:</p>
<p>XPathNodeIterator iterator = (XPathNodeIterator)nav.Evaluate(expr);</p>
<p>XmlDocument xmldoc = new XmlDocument();</p>
<p>xmldoc.LoadXml(message.Value);</p>
<p>XmlNodeList nodes = xmldoc.SelectNodes(xpath);</p>
<p>foreach (XmlNode node in nodes)</p>
<p>result += node.OuterXml;</p>
<p>break;</p>
<p>case XPathResultType.Error:</p>
<p>throw new ArgumentException(&#8220;Invalid XPath query.&#8221;);</p>
<p>}</p>
<p>return new SqlString(result);</p>
<p>}</p>
<p>};</p>
<p>Hope this helps <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Dynamic XPath using Xml DataType in SQL Server]]></title>
<link>http://adglopez.wordpress.com/2009/11/13/dynamic-xpath-using-xml-datatype-in-sql-server/</link>
<pubDate>Fri, 13 Nov 2009 20:46:40 +0000</pubDate>
<dc:creator>adglopez</dc:creator>
<guid>http://adglopez.wordpress.com/2009/11/13/dynamic-xpath-using-xml-datatype-in-sql-server/</guid>
<description><![CDATA[Hi, today I was working with in SQL trying to execute a query against a variable of Xml type. Someth]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Hi, today I was working with in SQL trying to execute a query against a variable of Xml type. Something likes this:</p>
<p>declare @xml xml, @xpath varchar(512)</p>
<p>set @xml = &#8216;&#60;Hello&#62;world&#60;/Hello&#62;&#8217;</p>
<p>select @xml.value(@xpath,&#8217;varchar(255)&#8217;)</p>
<p>The error trying to run this was</p>
<p>The argument 1 of the XML data type method &#8220;value&#8221; must be a string literal.</p>
<p>Taking a look about how to solve this I found this thread on MSND:</p>
<p><a href="http://social.msdn.microsoft.com/Forums/en-US/sqlxml/thread/b93d0790-e239-459e-a4e3-7511475f548b">http://social.msdn.microsoft.com/Forums/en-US/sqlxml/thread/b93d0790-e239-459e-a4e3-7511475f548b</a></p>
<p>Continuing with the idea provided by <a href="http://social.msdn.microsoft.com/Profile/en-US/?user=c.%20st.&#38;referrer=http%3a%2f%2fsocial.msdn.microsoft.com%2fForums%2fen-US%2fsqlxml%2fthread%2fb93d0790-e239-459e-a4e3-7511475f548b&#38;rh=ri3Lt4NBRSG6V0WsUzh2FEykwrVjGmquv6E5lYlSXaQ%3d&#38;sp=forums">Christian</a>, I created a stored procedure that calls to sp_executes</p>
<p>ql using output parameters and wrapped the logic in a new stored procedure.</p>
<p>So basically, now you can run something like this</p>
<p>EXECUTE [MyDB].[dbo].[Xpath] @xml,@xpath, @result output</p>
<p>Here is the code to create the stored procedure:</p>
<p>CREATE PROCEDURE Xpath</p>
<p>(</p>
<p>@xml xml,</p>
<p>@xpath varchar(1024),</p>
<p>@result varchar(255) OUTPUT</p>
<p>)</p>
<p>AS</p>
<p>BEGIN</p>
<p>DECLARE</p>
<p>@EncodedXPath nvarchar(200),</p>
<p>@Sql nvarchar(max),</p>
<p>@SeqValue varchar(512),</p>
<p>@paramDefinition nvarchar(255)</p>
<p>SET @EncodedXPath = REPLACE(@xpath, &#8221;&#8221;, &#8221;&#8221;&#8221;)</p>
<p>SET @Sql = N&#8217;SET @SeqValueOUT = @xmlVar.value(&#8221;&#8217; + @EncodedXPath + N&#8221;&#8217;, &#8221;varchar(25)&#8221;)&#8217;</p>
<p>SET @paramDefinition  = &#8216;@xmlVar xml, @SeqValueOUT varchar(25) OUTPUT&#8217;</p>
<p>EXEC sp_executesql      @Sql, @paramDefinition, @xmlVar = @xml, @SeqValueOUT = @SeqValue OUTPUT</p>
<p>SELECT @result = @SeqValue</p>
<p>END</p>
<p>GO</p>
<p>And, here is a sample to use it:</p>
<p>DECLARE  @xml xml,  @xpath nvarchar(200)</p>
<p>SET @xml=&#8217;&#60;Root&#62;&#60;Device&#62;&#60;Inspection&#62;&#60;Status&#62;OK&#60;/Status&#62;&#60;/Inspection&#62;&#60;/Device&#62;&#60;/Root&#62;&#8217;</p>
<p>SET @xpath = &#8216;/Root[1]/Device[1]/Inspection[1]/Status[1]&#8216;</p>
<p>DECLARE @result varchar(255)</p>
<p>EXECUTE [MyDb].[dbo].[Xpath] @xml,@xpath, @result output</p>
<p>select @result</p>
<p>Thanks again to Christian, the idea is based on his post.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Erro: Os métodos de ligação de dados como Eval(), XPath() e Bind() só podem ser usados no contexto de um controle limitado por dados.]]></title>
<link>http://dotnetche.wordpress.com/2009/11/13/erro-os-metodos-de-ligacao-de-dados-como-eval-xpath-e-bind-so-podem-ser-usados-no-contexto-de-um-controle-limitado-por-dados/</link>
<pubDate>Fri, 13 Nov 2009 17:55:33 +0000</pubDate>
<dc:creator>tiagotomasel</dc:creator>
<guid>http://dotnetche.wordpress.com/2009/11/13/erro-os-metodos-de-ligacao-de-dados-como-eval-xpath-e-bind-so-podem-ser-usados-no-contexto-de-um-controle-limitado-por-dados/</guid>
<description><![CDATA[Solução para: Os métodos de ligação de dados como Eval(), XPath() e Bind() só podem ser usados no co]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Solução para: Os métodos de ligação de dados como Eval(), XPath() e Bind() só podem ser usados no contexto de um controle limitado por dados.</p>
<p>Ae pessoal! Encontrei a solução para o erro: Os métodos de ligação de dados como Eval(), XPath() e Bind() só podem ser usados no contexto de um controle limitado por dados.</p>
<p>Segue abaixo a solução:<br />
Crie uma nova classe (Ela será o seu componente DropDownList) e coloque o código abaixo&#8230;<br />
<code><br />
using System;<br />
using System.Collections;<br />
using System.ComponentModel;<br />
using System.Security.Permissions;<br />
using System.Web;<br />
using System.Web.UI;<br />
using System.Web.UI.WebControls;</p>
<p>namespace TIAGO.Componentes<br />
{<br />
    [AspNetHostingPermission(SecurityAction.Demand, Level = AspNetHostingPermissionLevel.Minimal)]<br />
    [AspNetHostingPermission(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]<br />
    public class DataBoundDropDownlist : DropDownList<br />
    {<br />
        protected override void OnDataBinding(EventArgs e)<br />
        {<br />
            try<br />
            {<br />
                base.OnDataBinding(e);<br />
            }<br />
            catch (InvalidOperationException)<br />
            {<br />
                this.GetData().Select(<br />
                    DataSourceSelectArguments.Empty,<br />
                    new DataSourceViewSelectCallback(DoSelect));<br />
            }<br />
        }<br />
        private void DoSelect(IEnumerable data)<br />
        {<br />
            this.PerformDataBinding(data);<br />
        }</p>
<p>    }<br />
}<br />
</code></p>
<p>O projeto onde ela se encontra deve ter referência para System.Web.</p>
<p>Se ela não aparecer sozinha na ToolBox, crie uma nova aba na sua toolbox e adicione a dll do projeto dela&#8230; No meu caso eu criei um novo projeto dentro da solution e coloquei ela lá&#8230; E meu projeto se chama TIAGO.Componentes.</p>
<p>Ai você utiliza a nossa DataBoundDropDownlist em vez da DropDownList do framework!</p>
<p>Esta é a solução mais rápida!</p>
<p>Espero ter ajudado!</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[XmlElement and XElement]]></title>
<link>http://steveatbgbsoftware.wordpress.com/2009/11/13/code-format-test/</link>
<pubDate>Fri, 13 Nov 2009 11:48:17 +0000</pubDate>
<dc:creator>Stephen</dc:creator>
<guid>http://steveatbgbsoftware.wordpress.com/2009/11/13/code-format-test/</guid>
<description><![CDATA[Since the first version of the .NET framework an XML DOM has been available for manipulating and sea]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Since the first version of the .NET framework an XML DOM has been available for manipulating and searching XML documents. This has been in the <a href="http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.aspx">System.Xml</a> namespace and used classes like <a href="http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.aspx">XmlDocument</a> and <a href="http://msdn.microsoft.com/en-us/library/system.xml.xmlelement.aspx">XmlElement</a>. These xml classes support <a href="http://www.w3schools.com/XPath/xpath_syntax.asp">XPath</a> queries. XPath allows any xml node or list of nodes to be queried using an XPath expression.</p>
<pre class="brush: csharp;">// &#60;Document&#62;
//  &#60;Item&#62;Item 1&#60;/Item&#62;
//  &#60;Item&#62;Item 2&#60;/Item&#62;
// &#60;/Document&#62;

var xmlDoc = new XmlDocument();
xmlDoc.Load( "Documents.xml" );
XmlNodeList nodeList = xmlDoc.SelectNodes( "/Document );
XmlNode node = xmlDoc.SelectSingleNode( "/Document );</pre>
<p>This code create an XML document in memory does two XPath queries, the first returns all the XML &#60;Items&#62; under &#60;Document&#62;, the seconds returns just the first &#60;Item&#62;</p>
<p>In .NET framework 3.5 the <a href="http://msdn.microsoft.com/en-us/library/system.xml.linq.aspx">System.Xml.Linq</a> namespace was added with which provides the LINQ to XML classes, <a href="http://msdn.microsoft.com/en-us/netframework/aa904594.aspx">see</a> from more details on LINQ. The LINQ to XML also provides an in-memory XML DOM which allows manipulation and searching of XML documents.</p>
<pre class="brush: csharp;">XDocument xDoc = XDocument.Load( "Documents.xml" );
var query = from x in xDoc.Root.Elements( "Item" ) select x;
XElement item = doc.Root.Element( "Document" ).Element( "Item" );</pre>
<p>This code is basically the same as the above, the first query returns an enumerator of all the &#60;Item&#62; elements, the second queries the elements directly to get the first &#60;Item&#62;</p>
<p>Initially I used Xml* classes (which was all that was available at the time) with XPath queries to retrieve xml nodes, I found the XPath query syntax hard use, although with some patients and research complex queries can be made. The programmatic manipulation of the Xml* classes was also a bit painful, XmlElements had to be created by the XmlDocument that would own then, copying elements between different documents required elements to be imported into the target document.</p>
<p>When 3.5 can along I started using the LINQ to XML classes which are <a href="http://msdn.microsoft.com/en-us/library/system.xml.linq.xdocument.aspx">XDocument</a>, <a href="http://msdn.microsoft.com/en-us/library/system.xml.linq.xelement.aspx">XElement</a>, etc. These classes felt more light weight and easier to use. There is an extension method that allows XPath queries on XNode objects, <a href="http://msdn.microsoft.com/en-us/library/bb342176.aspx">XPathSelectElements</a> or <a href="http://msdn.microsoft.com/en-us/library/system.xml.xpath.extensions.xpathevaluate.aspx">XPathEvaluate</a></p>
<p>What I also found is that XPath queries did not seem that fast and I was interested in comparing the performance of some simple XPath queries to the LINQ to XML equivalents.</p>
<pre class="brush: csharp;">// &#60;Document&#62;
//    &#60;Body&#62;
//       &#60;Section&#62;
//          &#60;Item&#62;
//             &#60;Name&#62;&#60;/Name&#62;
//          &#60;Item&#62;
//            ...
//       &#60;/Section&#62;
//    &#60;/Body&#62;
// &#60;/Document&#62;</pre>
<p>The test XML document has a very basic structure, with the &#60;Item&#62; tag repeated about 100 times. In all the testing I did not time the creation of the XML document in memory only the time taken to query the XML. In the case where many items where returned from the query I would iterate over all the items to ensure the items where available.</p>
<pre class="brush: csharp;">XmlNodeList nodeList = xmlDoc.SelectNodes( "//Item" );
var query = from x in doc.Descendants( "Item" ) select x;</pre>
<p>This test is returning all &#60;Item&#62; elements in the document, in this case the LINQ to XML query was about 3 times faster than the XPATH query.</p>
<pre class="brush: csharp;">string xPath = "/Document/Body/Section/Item";
XmlNodeList nodeList = xmlDoc.SelectNodes( xPath );

XElement section = doc.Root.Element( "Body" ).Element( "Section" );
var query = from x in section.Elements( "Item" ) select x;</pre>
<p>In this case we are returning all the &#60;Item&#62; elements from a specific part of the XML document. The LINQ to XML query is about 4 times faster than the XPATH query.</p>
<p>In general using the LINQ to XML Element(“name 1”).Element(“name 2”) notation to find an element is very fast, although if the element does not exists a null check should be done.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Spring JCR Extension]]></title>
<link>http://pronetics.wordpress.com/2009/11/03/spring-jcr-extension/</link>
<pubDate>Tue, 03 Nov 2009 09:54:22 +0000</pubDate>
<dc:creator>desmax74</dc:creator>
<guid>http://pronetics.wordpress.com/2009/11/03/spring-jcr-extension/</guid>
<description><![CDATA[Author:Salvatore Incandela]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><!-- SlideShare error: doc is missing or has illegal characters /[^-_a-zA-Z0-9]/ --></p>
<p>Author:Salvatore Incandela</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Using collaborative technologies for healthcare in the home]]></title>
<link>http://enggtech.wordpress.com/2009/10/22/using-collaborative-technologies-for-healthcare-in-the-home/</link>
<pubDate>Thu, 22 Oct 2009 21:12:12 +0000</pubDate>
<dc:creator>Visitor Blogs</dc:creator>
<guid>http://enggtech.wordpress.com/2009/10/22/using-collaborative-technologies-for-healthcare-in-the-home/</guid>
<description><![CDATA[Summary: The number of people in the U.S. diagnosed with diabetes is now reaching 24 million. Diabet]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><strong>Summary:</strong> The number of people in the U.S. diagnosed with diabetes is now             reaching 24 million. Diabetes requires monitoring. In this article, get an             introduction to the concept of continuing care, particularly in the home. This             article describes how diabetes monitoring can be improved through             collaborative technologies. See how software from MyCareTeam, IBM, and other             organizations are used in an example in support of diabetes monitoring.             Understand information and Web-based technologies, such as XML storage and             services (for example, through IBM® DB2® pureXML™) in the             context of continuing care, as well as related initiatives, such as the             Continua Health Alliance&#8217;s role in selecting appropriate standards. This             article summarizes the impact of these technologies on the building of agile             and collaborative systems for healthcare, and highlights the significant             benefits of collaborative continuing care that include cost reduction and             increased quality of healthcare.</p>
<p style="text-align:center;"><a href="http://www.ibm.com/developerworks/data/library/techarticle/dm-0910purexmlhealthcare/index.html?S_TACT=105AGX54&#38;S_CMP=C1015&#38;ca=dnw-1039&#38;ca=dth-i&#38;open&#38;cm_mmc=6139-_-n-_-vrm_newsletter-_-10731_135450&#38;cmibm_em=dm:0:2633036"><img src='http://enggtech.files.wordpress.com/2009/10/figure3_3_2.gif' alt='' /></a></p>
<p>This article introduced some results concerning continuing care for                 diabetes. In particular, studies have shown that increased patient Health                 Care Practitioner interaction, especially more personalized interactions,                 increases patient frequency of blood glucose monitoring. Providing                 software that encourages personalized interactions improves diabetes                 monitoring. The contribution of Web-based technologies and associated                 initiatives, such as the MyCareTeam software, to share data is                 significant. In addition, the diabetes monitoring demonstration described                 in this article used standard specifications in the area of healthcare                 from HL7, IHE, and Continua, and in the area of XML from the W3C, such as                 XQuery. An XML store, DB2 pureXML, accessed through Universal Services,                 was used to easily store and manipulate monitoring information. The                 demonstration illustrated the first steps towards building a Web-based                 infrastructure for continuing care in the home.</p>
<p style="text-align:center;"><a href="http://www.ibm.com/developerworks/data/library/techarticle/dm-0910purexmlhealthcare/index.html?S_TACT=105AGX54&#38;S_CMP=C1015&#38;ca=dnw-1039&#38;ca=dth-i&#38;open&#38;cm_mmc=6139-_-n-_-vrm_newsletter-_-10731_135450&#38;cmibm_em=dm:0:2633036"><img src='http://enggtech.files.wordpress.com/2009/10/figure3_1.gif' alt='' /></a></p>
<p><a name="resources"><span class="atitle">Resources</span></a></p>
<p><strong>Learn</strong></p>
<ul>
<li> <a href="http://www.mycareteam.com/">MyCareTeam</a>: Learn more about                 MyCareTeam, disease management software for diabetes patients.</li>
<li> <a href="http://www.continuaalliance.org/">Continua Health Alliance</a>:                 Learn more about Continua Health Alliance, a non-profit, open industry                 coalition of healthcare and technology companies.</li>
<li> <a href="http://www.ibm.com/software/data/db2/xml/">DB2 pureXML</a>: Get                 more information about, a hybrid XML and relational store from IBM.</li>
<li> &#8220;<a href="http://www.ibm.com/developerworks/data/library/techarticle/dm-0805malaika/">Universal Services for pureXML using Data Web Services</a>&#8221;                 (developerWorks, August 2008): Enable DB2 pureXML columns to be accessed                 through Web service operations.</li>
<li> &#8220;<a href="http://www.ibm.com/developerworks/data/library/techarticle/dm-0902malaika/">IBM Lotus Sametime and DB2 pureXML  supporting healthcare collaboration</a>&#8221;                 (developerWorks, Feb 2009): Follow a healthcare scenario based on an                 end-to-end XML architecture.</li>
<li> <a href="http://www.ibm.com/software/lotus/portal/value/mobileaccelerator/">IBM Lotus Mobile Portal Accelerator</a>:                 Learn more about this content adaption product that helps enterprises and                 service providers deliver portal content to a broad range of mobile                 devices.</li>
<li> <a href="http://www.ibm.com/software/integration/sensor-events/">IBM WebSphere Sensor Events</a>:                 Learn more about this product that delivers services supporting sensor                 integration.</li>
<li><a href="http://www.ibm.com/developerworks/data/?S_TACT=105AGX54&#38;S_CMP=C1015">developerWorks Information Management zone</a>:                 Learn more about Information Management. Find technical documentation,                 how-to articles, education, downloads, product information, and                 more.</li>
<li>Stay current with                 <a href="http://www.ibm.com/developerworks/offers/techbriefings/?S_TACT=105AGX54&#38;S_CMP=C1015">developerWorks technical events and webcasts</a>.</li>
</ul>
<p><strong>Get products and technologies</strong></p>
<ul>
<li> <a href="http://www.ibm.com/developerworks/downloads/im/udbexp/learn.html">DB2 Express-C 9.7</a>:                 Download DB2 Express-C 9.7, a no-charge version of DB2 Express database                 server for the community that includes pureXML.</li>
<li> <a href="http://www.ibm.com/developerworks/downloads/im/udb/learn.html">DB2 9.7 for Linux, UNIX, and              Windows</a>:             Download a free trial version of DB2 LUW.</li>
<li>Build your next                 development project with                 <a href="http://www.ibm.com/developerworks/downloads/">IBM trial software</a>,                 available for download directly from developerWorks.</li>
</ul>
<p><strong>Discuss</strong></p>
<ul>
<li><a href="http://www.ibm.com/developerworks/forums/forum.jspa?forumID=1423">Participate in the discussion forum</a>.</li>
<li>Participate in                 <a href="http://www.ibm.com/developerworks/blogs/">developerWorks blogs</a> and get involved in the                 <a href="http://www.ibm.com/developerworks/community">My developerWorks community</a>;                 with your personal profile and custom home page, you can tailor                 developerWorks to your interests and interact with other developerWorks                 users.</li>
</ul>
<p><a href="http://www.ibm.com/developerworks/data/library/techarticle/dm-0910purexmlhealthcare/index.html?S_TACT=105AGX54&#38;S_CMP=C1015&#38;ca=dnw-1039&#38;ca=dth-i&#38;open&#38;cm_mmc=6139-_-n-_-vrm_newsletter-_-10731_135450&#38;cmibm_em=dm:0:2633036">Using collaborative technologies for healthcare in the home</a>.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[BPEL // The result is empty for the XPath expression]]></title>
<link>http://snowjunkiedev.wordpress.com/2009/10/22/bpel-the-result-is-empty-for-the-xpath-expression/</link>
<pubDate>Thu, 22 Oct 2009 19:18:54 +0000</pubDate>
<dc:creator>Alastair Vance</dc:creator>
<guid>http://snowjunkiedev.wordpress.com/2009/10/22/bpel-the-result-is-empty-for-the-xpath-expression/</guid>
<description><![CDATA[Some of my xml elements are optional.  The customer need not populate them or even include them in t]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Some of my xml elements are optional.  The customer need not populate them or even include them in the file.  BPEL does not like when I try to retrieve the value like this:</p>
<p><span style="color:#808080;">bpws:getVariableData(&#8216;var_IncomingFile&#8217;,'ORDERS&#8217;,'/ns2:ORDERS/ns2:ORDER[bpws:getVariableData("var_LoopIterator")]/ns2:OPTIONAL_FIELD/text()&#8217;)</span></p>
<p>It spits out this error and throws a selectionFailure:</p>
<p><span style="color:#808080;">Error in evaluate &#60;from&#62; expression at line &#8220;347&#8243;. The result is empty for the XPath expression : &#8220;bpws:getVariableData(&#8216;var_IncomingFile&#8217;,'ORDERS&#8217;,'/ns2:ORDERS/ns2:ORDER[bpws:getVariableData("var_LoopIterator")]/ns2:OPTIONAL_FIELD/text()&#8217;)&#8221;.</span></p>
<p>To get it to work I had to do this:</p>
<p><span style="color:#808080;">concat(bpws:getVariableData(&#8216;var_IncomingFile&#8217;,'ORDERS&#8217;,'/ns2:ORDERS/ns2:ORDER[bpws:getVariableData("var_LoopIterator")]/ns2:OPTIONAL_FIELD/text()&#8217;),&#8221;)</span></p>
<p>Is there a more elegant way?</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[IBM developerWorks : DB2 9 Fundamentals certification 730 prep series]]></title>
<link>http://enggtech.wordpress.com/2009/10/22/ibm-developerworks-db2-9-fundamentals-certification-730-prep-series/</link>
<pubDate>Thu, 22 Oct 2009 19:03:41 +0000</pubDate>
<dc:creator>Visitor Blogs</dc:creator>
<guid>http://enggtech.wordpress.com/2009/10/22/ibm-developerworks-db2-9-fundamentals-certification-730-prep-series/</guid>
<description><![CDATA[The Fundamentals tutorial series provides an introduction to SQL (Structured Query Language) and cov]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>The Fundamentals tutorial series provides an introduction to SQL (Structured Query Language) and covers how DB2® 9 is packaged and installed, how to create databases and database objects, and the basics of database security and transaction isolation. These tutorials provide a solid base for each section of the exam. However, you should not rely on these tutorials as your only preparation for the exam.</p>
<p><!--START RESERVED FOR FUTURE USE FILES - GENERIC LANDING PAGES--><!-- Reserved include: Abstract area -->  <!--END RESERVED FOR FUTURE USE INCLUDE FILES - GENERIC LANDING         PAGES-->After a quick registration, you can begin a tutorial. Each tutorial should take about an hour to complete. You can take the tutorials online, or download a PDF or zip file.</p>
<ul>
<li> <a href="http://www.ibm.com/developerworks/edu/dm-dw-db2-cert7301.html">DB2 9 Fundamentals exam 730 prep, Part 1: Planning</a><br />
This tutorial introduces the basics of the DB2 products and tools, along with the concepts of data warehousing and OLAP.</li>
<li> <a href="http://www.ibm.com/developerworks/edu/dm-dw-db2-cert7302.html">DB2 9 Fundamentals exam 730 prep, Part 2: Security</a><br />
This tutorial introduces you to DB2 security. Learn about DB2 authentication, authorization, and privileges.</li>
<li> <a href="http://www.ibm.com/developerworks/edu/dm-dw-db2-cert7303.html">DB2 9 Fundamentals exam 730 prep, Part 3: Accessing DB2 data</a><br />
This tutorial gives you an introduction to the objects that make up a DB2 database, and the different factors which affect how the database is created. After a brief introduction to DB2 objects, learn about the tools available to create, access, and manipulate DB2 objects.</li>
<li> <a href="http://www.ibm.com/developerworks/edu/dm-dw-db2-cert7304.html?S_TACT=105AGX19&#38;S_CMP=db2cert">DB2 9 Fundamentals exam 730 prep, Part 4: Working with DB2 data</a><br />
This tutorial introduces you to Structured Query Language (SQL), and gives you the basics of how DB2 9 uses SQL to manipulate data in a relational database.</li>
<li> <a href="http://www.ibm.com/developerworks/edu/dm-dw-db2-cert7305.html?S_TACT=105AGX19&#38;S_CMP=db2cert">DB2 9 Fundamentals exam 730 prep, Part 5: Working with DB2 objects</a><br />
This tutorial discusses data types, tables, views, and indexes as defined by DB2 9. It explains the features of these objects, how to create and manipulate them using Structured Query Language (SQL), and how they can be used in an application.</li>
<li> <a href="http://www.ibm.com/developerworks/edu/dm-dw-db2-cert7306.html?S_TACT=105AGX19&#38;S_CMP=db2cert">DB2 9 Fundamentals exam 730 prep, Part 6: Data concurrency</a><br />
This tutorial introduces you to the concept of data consistency and to the various mechanisms that are used by DB2 9 to maintain database consistency in both single and multi-user environments.</li>
<li> <a href="http://www.ibm.com/developerworks/edu/dm-dw-db2-cert7307.html?S_TACT=105AGX19&#38;S_CMP=db2cert">DB2 9 Fundamentals exam 730 prep, Part 7: Introducing Xquery</a><br />
DB2 9 features significant new support for storing, managing, and querying XML data. Learn how to query data stored in XML columns using XQuery.</li>
</ul>
<p>Once you have the fundamentals mastered, you may be interested in learning more about DB2 database administration tasks. If so, check out the <a href="http://www.ibm.com/developerworks/offers/lp/db2cert/db2-cert731.html?S_TACT=105AGX19&#38;S_CMP=db2certlp">DB2 DBA exam 731 prep tutorials</a>.</p>
<p><a href="http://www.ibm.com/developerworks/offers/lp/db2cert/db2-cert730.html?S_TACT=105AGX19&#38;S_CMP=db2cert">IBM developerWorks : DB2 9 Fundamentals certification 730 prep series</a>.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Extracting content from XHTML using XPATH and dom4j]]></title>
<link>http://hrycan.com/2009/10/17/extracting-content-from-xhtml-using-xpath-and-dom4j/</link>
<pubDate>Sun, 18 Oct 2009 03:25:58 +0000</pubDate>
<dc:creator>Nick Hrycan</dc:creator>
<guid>http://hrycan.com/2009/10/17/extracting-content-from-xhtml-using-xpath-and-dom4j/</guid>
<description><![CDATA[If you need to read, write, navigate, create or modify XML documents, take a look at dom4j. Browsing]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>If you need to read, write, navigate, create or modify XML documents, take a look at dom4j.  Browsing the dom4j <a href="http://www.dom4j.org/dom4j-1.6.1/cookbook.html" target="newwin">cookbook</a> and <a href="http://www.dom4j.org/dom4j-1.6.1/guide.html" target="newwin">quick start guide</a>, it seems trivial to extract content from an XML document using XPATH.  Consider the following XML document:</p>
<pre class="brush: xml;">
&#60;?xml version=&#34;1.0&#34; encoding=&#34;UTF-8&#34;?&#62;
&#60;html xmlns=&#34;http://www.w3.org/1999/xhtml&#34;&#62;
&#60;head&#62;
	&#60;title/&#62;
&#60;/head&#62;
&#60;body&#62;
	&#60;div&#62;
		&#60;p&#62;Paragraph 1&#60;/p&#62;
	&#60;/div&#62;
	&#60;div&#62;
		&#60;p&#62;Paragraph 2&#60;/p&#62;
	&#60;/div&#62;
	&#60;div&#62;
		&#60;p&#62;Paragraph 3&#60;/p&#62;
	&#60;/div&#62;
&#60;/body&#62;
&#60;/html&#62;
</pre>
<p><b>Listing 1: Sample XML</b></p>
<p>You would think the XPATH to extract the contents of each paragraph would be </p>
<pre class="brush: java;">
String xpathExpr = &#34;//div/p&#34;;
</pre>
<p>If you try it out, you will see there are no matches.  The gotcha is the namespace</p>
<pre class="brush: xml;">
xmlns=&#34;http://www.w3.org/1999/xhtml&#34;
</pre>
<p>If that namspace was not specified, then the above XPATH expression would work.  The solution is to use an alternate set of API calls than what is shown in the standard XPATH examples in the dom4j documentation.</p>
<pre class="brush: java;">
package com.hrycan.blog.xml;

import java.util.List;
import java.util.Map;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import org.dom4j.Node;
import org.dom4j.XPath;

public class XPATHProcessor {

	private Map&#60;String, String&#62;  namespaceURIMap;

	public List&#60;Node&#62; extract(String content, String xpathExpr) throws DocumentException {
		Document document = DocumentHelper.parseText(content);
		XPath path = DocumentHelper.createXPath(xpathExpr);
		path.setNamespaceURIs(namespaceURIMap);

		List&#60;Node&#62; list = path.selectNodes(document.getRootElement());
		return list;
	}

	public void setNamespaceURIMap(Map&#60;String, String&#62; namespaceURIMap) {
		this.namespaceURIMap = namespaceURIMap;
	}
}
</pre>
<p>Here we use the DocumentHelper object to create an XPath object and then set it&#8217;s namespace URIs map instead of using the boilerplate document.selectNodes(xpathExpr) call.</p>
<p>Here is the JUnit test showing how it would be used with the content of Listing1 and the corresponding XPATH expression using the namespace.</p>
<pre class="brush: java;">
package com.hrycan.blog.xml;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.dom4j.DocumentException;
import org.dom4j.Node;
import org.junit.Test;
import static org.junit.Assert.assertTrue;

public class XPATHProcessorTest {
	private XPATHProcessor xpathProcessor;

	@Test
	public void testExtract() throws DocumentException {
		xpathProcessor = new XPATHProcessor();
		Map&#60;String, String&#62;  namespaceURIMap = new HashMap&#60;String, String&#62; ();
		namespaceURIMap.put(&#34;html&#34;, &#34;http://www.w3.org/1999/xhtml&#34;);
		xpathProcessor.setNamespaceURIMap(namespaceURIMap);

		String content = //content of Listing1 shown above
		String xpathExpr = &#34;//html:div/html:p&#34;;

		List&#60;Node&#62; list = xpathProcessor.extract(content, xpathExpr);
		assertTrue(list.size() == 3);
	}
}
</pre>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Service Functions – XML (QTP, VBScript)]]></title>
<link>http://automationbeyond.wordpress.com/2009/10/02/service-functions-xml/</link>
<pubDate>Fri, 02 Oct 2009 13:18:36 +0000</pubDate>
<dc:creator>Albert Gareev</dc:creator>
<guid>http://automationbeyond.wordpress.com/2009/10/02/service-functions-xml/</guid>
<description><![CDATA[In the code examples I present I often refer to routine functions. In my framework I have specialize]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>In the code examples I present I often refer to routine functions.</p>
<p>In my framework I have specialized libraries to call from.  In my blog I have been providing them along with the posts but now I see that better to keep all in one place and “call” with the link.</p>
<p><strong> </strong></p>
<p><strong>Using built-in QTP-XML Objects and Functions</strong></p>
<p><strong><a href="http://automationbeyond.wordpress.com/2009/07/14/qtp-xml-service-functions-1/" target="_blank">Returns reference of XML Element</a></strong></p>
<p><strong><a href="http://automationbeyond.wordpress.com/2009/07/15/qtp-xml-service-functions-2/" target="_blank">Returns text value of XML Element</a></strong></p>
<p><strong><a href="http://automationbeyond.wordpress.com/2009/07/16/qtp-xml-service-functions-3/" target="_blank">Returns reference of XML Attribute</a></strong></p>
<p><strong><a href="http://automationbeyond.wordpress.com/2009/07/17/qtp-xml-service-functions-4/" target="_blank">Returns text value of XML Attribute</a></strong></p>
<p><strong><a href="http://automationbeyond.wordpress.com/2009/07/21/qtp-xml-service-functions-5/" target="_blank">Returns text value of a comment in XML Element</a></strong></p>
<p><strong><a href="http://automationbeyond.wordpress.com/2009/11/21/qtp-xml-service-functions-6/" target="_blank">Create a child element and return its reference</a></strong></p>
<p><strong> </strong></p>
<p><strong>Using Microsoft.XMLDOM Objects</strong></p>
<p><strong><a href="http://automationbeyond.wordpress.com/2009/11/15/qtp-xml-service-functions-7/" target="_blank">Add processing instruction</a></strong></p>
<p><strong> </strong></p>
<p><strong>XML queries: XPath</strong></p>
<p><strong><a href="http://automationbeyond.wordpress.com/2009/11/23/xpath-1/" target="_blank">XPath introduction and references</a></strong></p>
<p><strong> </strong></p>
<p><strong>XML transformation: XSL</strong></p>
<p><strong><a href="http://automationbeyond.wordpress.com/2009/11/30/xsl-introduction/" target="_blank">XSL introduction and references</a></strong></p>
<p><strong><a href="http://automationbeyond.wordpress.com/2009/12/02/xml-verification-example-xsl-html/" target="_blank">XML verification example (XSL, HTML)</a></strong></p>
<p><strong><a href="http://automationbeyond.wordpress.com/2009/12/03/text-file-compare-report-example-xml-xsl-html/" target="_blank">Text File Compare Report example (XML, XSL, HTML)</a></strong></p>
<p><strong> </strong></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[XPath Find The Position Of A Node]]></title>
<link>http://sladescross.wordpress.com/2009/09/27/xpath-find-the-position-of-a-node/</link>
<pubDate>Sun, 27 Sep 2009 10:25:47 +0000</pubDate>
<dc:creator>sladescross</dc:creator>
<guid>http://sladescross.wordpress.com/2009/09/27/xpath-find-the-position-of-a-node/</guid>
<description><![CDATA[http://stackoverflow.com/questions/226405/find-position-of-a-node-using-xpath &lt;a&gt;     &lt;b]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><a href="http://stackoverflow.com/questions/226405/find-position-of-a-node-using-xpath">http://stackoverflow.com/questions/226405/find-position-of-a-node-using-xpath</a></p>
<p><code>&#60;a&#62;<br />
    &#60;b&#62;zyx&#60;/b&#62;<br />
    &#60;b&#62;wvu&#60;/b&#62;<br />
    &#60;b&#62;tsr&#60;/b&#62;<br />
    &#60;b&#62;qpo&#60;/b&#62;<br />
&#60;/a&#62;</code></p>
<p>count(a/b[.='tsr']/preceding-sibling::*)+1</p>
<p>or in an InfoPath expression</p>
<p>count(current()/preceding-sibling::*) + 1</p>
<p>count(../preceding-sibling::*) + 1</p>
<p><a href="http://www.biglist.com/lists/xsl-list/archives/200109/msg00583.html">http://www.biglist.com/lists/xsl-list/archives/200109/msg00583.html</a></p>
<p>To find the position of a particular node within the source tree, use<br />
count(). For example, count(ancestor::parentMenu/preceding-sibling::*)+1</p>
<p><a href="http://www.novell.com/communities/node/6276/using-xpath-get-position-node-node-set">http://www.novell.com/communities/node/6276/using-xpath-get-position-node-node-set</a></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Infopath xdXDocument And Secondary Data Sources]]></title>
<link>http://sladescross.wordpress.com/2009/09/25/infopath-xdxdocument-and-secondary-data-sources/</link>
<pubDate>Fri, 25 Sep 2009 18:34:04 +0000</pubDate>
<dc:creator>sladescross</dc:creator>
<guid>http://sladescross.wordpress.com/2009/09/25/infopath-xdxdocument-and-secondary-data-sources/</guid>
<description><![CDATA[http://support.microsoft.com/kb/827008]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><a href="http://support.microsoft.com/kb/827008">http://support.microsoft.com/kb/827008</a></p>
</div>]]></content:encoded>
</item>

</channel>
</rss>
