KeyLimeTie Blog

Google Sitemap Generator v2.0 Released!!!!

By Brian Pautsch – 5/30/2006. Posted to Applications.

Version 4.1 is now available! Click here for more details!

(You will automatically be redirected to the new version in 5 seconds).

Google Sitemaps Version 2.0 coming any day now!

By Brian Pautsch – 5/23/2006. Posted to Thoughts.

Version 4.1 is now available! Click here for more details!

(You will automatically be redirected to the new version in 5 seconds).

XPath Expression Test Application (C#)

By Brian Pautsch – 5/4/2006. Posted to Applications.

Recently, I've been using XML a lot in my side projects. When binding XML to GridViews, Repeaters and DataLists, it's very easy to set the element to display with an XPath command. For example, here's how to bind to DataList:
1<asp:DataList ID="dlBooks" runat="server">
2    <ItemTemplate>
3        <%# XPath("Title") %><br />
4        by <%# XPath("Author") %><br />
5        <br />
6        <i><%# XPath("BookText") %></i>
7    </ItemTemplate>
8</asp:DataList>
9
10
11protected void BindXML(string strXML)
12{
13    eNomInterface objAPI = null;
14    XmlDataSource xds = null;
15    try
16    {
17        xds = new XmlDataSource();
18        xds.Data = objAPI.Results.InnerXml;
19        xds.XPath = "*/Books";
20        dlBooks.DataSource = xds;
21        dlBooks.DataBind();
22    }
23    catch (Exception ex)
24    {
25        //Log exception
26    }
27    finally
28    {
29        if (xds != null)
30        {
31            xds.Dispose();
32            xds = null;
33        }
34    }
35}
But as I mentioned in a recent blog, I haven't memorized all of the XPath expressions. I know there aren't a ton, but who has the time. When I'm writing code, I often reference other code to find the expression I need (what a pain to search through code). Then when I test it out, I'm constantly reworking the expressions until I get what I want. So that's when I decided to write this little application.

This application basically allows you to select or paste in source XML. Then you can enter in an XPath expression and select the command to execute. After doing so, the results (or error) will display. You can also take your results and load them into the source XML textbox with a button click...this allows you to easily test XPath expresssions on results from previous queries. This is much better than experimenting in your code!

The XPath expression examples all came from MSDN. The application has links to the website and I also supplied the example XML and XPath expressions. Also, I pulled in all of the MSDN examples so you can easily find an example of the expression you're looking to execute.

Download Application
Download Source code

30 Best Practices for Integrating Web Services

By Brian Pautsch – 5/2/2006. Posted to Thoughts.

I was doing some research on Web Services and came across this webpage. It's Chapter 13 from Thomas Erl's book on Service-Oriented Architecture is about integrating web services.

It's great for people who know little to nothing about Web Services and want to learn. And will teach even those of us who know a lot of Web Services already.

Check it out: PerfectXML website.

Photos on Flickr

More Photos »

Search Blog


Archives