Using the XPath API to figure out my stats

One major problem I have with base WordPress is while it does a good job giving you stats around views (the number of hits you get per post) it does not do a good job for post counts. In the previous post I had to create a chart that showed how many blog posts I wrote in the months and years past. I am sure there is a plugin out there for this so if you know of one please mention it in the comments!

Continue reading

Quick Tip Video: Getting The XPath In Google Chrome

In this video I show how easy it is to get the xPath from Google Chrome. You can use the xPath when processing the DOM tree in your code. I use the javax.xml.xpath in Java to process DOM tree; the API is very powerful and easy to use.

Oldy but goody article: The Java XPath API

If you Google “Java XPath” this is one of the first articles returned. Clear and concise explanation for how to use the API:

XPath expressions are much easier to write than detailed Document Object Model (DOM) navigation code. When you need to extract information from an XML document, the quickest and simplest way is to embed an XPath expression inside your Java program. Java 5 introduces the javax.xml.xpath package, an XML object-model independent library for querying documents with XPath.

via The Java XPath API.

Managed Browser, Landmarks, and XPath

In a recent article posted by Chuck, article here, he writes about how the DataChange events happen in the Managed Browser container.  The event is very powerful and allows for actions to be called when a DOM node changes.  I described similar use cases in an article where we constructed a web browser component using XPath.  In that article we show how the managed browser component can use XPath’s to DOM elements so we can extract data out of the current web page at a given URL (the landmark).  In the end, we took the information from one web page and inserted (wired) it into another web page that hosts a basic form.  This uses the dynamic wiring and the property broker message queue to transport the data from one browser to another.  With the combination of XPath’s and Landmarks (regular expression based URL’s), you can create some pretty complex components for large web applications.  Also remember, you can define landmarks that can overlap.  So in short, if your landmark expression (regular expression) is viable for the current page the events and actions will execute – so having many landmark expressions that overlap is actually common.

All of the containers that ship with the product support these landmark concepts and you can even create your own containers based on the public API’s.  Mike Cooper outlines the steps for creating your own container in a wiki article – Creating a Composite Application Container.  He focuses on using Eclipse/SWT for the UI but as you can see from the other container types you can pretty much use any kind of UI technology with this generic framework.