Visual XPath (Free XPath Query Tool)
Download Source Code From This Page
What is Visual XPath?
Visual XPath is a graphical way of generating XPath query results. It can also be used to generate XPath queries dynamically by select XML nodes shown in the form of Tree. You can also generate queries for individual attributes.
What not is Visual XPath?
Visual XPath is not an XPath Parser. It utilizes Microsoft .NET XPath parser and other XML related APIs. It does not validate XML document against DTD or Schema. Although it will display error, if the XML document is not Well Formed. It is not an XML Editor therefore I removed Editing XML and Save As XML functions from the latest version. Although the XML file, if present on your hard disk, can be opened in the Notepad from the Utility.
How to integrate with VS.NET?
Step 1: Add to the External Tools
Goto Tools->External Tools
Add Visual XPath: Put $(ItemPath) in the Arguments text box
Step 2: Map a shortcut key to this external tool
Goto Tools->Customize
Press the Keyboard button and then write "Tools.ExternalCommand(n)" in the Show command containing text box, where n is the sequence of the Visual XPath tool. You can get this number by selecting the Tools window and counting the external tools upto Visual XPath.
The assign some shortcut key for this tools. I preferred Ctrl+Shirt+X, which is also available to use.
Known Bugs: There is a bug with the tool when dealing with nested “default namespaces“ notified by Omar. Currently, the tool searches for only root level default namespaces like in the following example.
<?xml version="1.0"?>
<Guitars xmlns="http://www.winphone.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.winphone.com/Guitars.xsd">
....
It works fine with the above file but it fails to recognize any default namespaces used inside the documents as shown in the following example.
<item>
....
<slash:comments>0</slash:comments>
<body xmlns="http://www.w3.org/1999/xhtml">
<p>
This is a sweet phone. One of these days I’ll talk a bit more about it, but
.....
In this rss file, the <body> tag also contains the default namespace which is treated as a document level namespace by the tool, hence putting the "def" (the word to represent default level namespace) word before any tag.
This bug only effects those files which contains the nested default namespaces.
I'll try to solve this bug as soon as possible.
Note: Email me if you have any type of comments, feature-requests and suggestions, either constructive or destructive (in case they are in the destructive category, please provide your opinion). I also need to know if there are any bugs, errors in the software. The source code is not included with the download. The only reason is that it is not very well documented therefore you can email me if you want it anyway.
If you like this then you might like my other Projects