XPath information in Visual Studio

Reason

Configuration files can grow very large, which is particularly true for the Web.config file in most Sitecore solutions. It contains XML elements and attributes often nested several layers deep.
When creating Sitecore include files or otherwise working with Web.config, the XPath of elements and attributes is often of interest, but determining the correct path can be a strain when reaching the “deeper levels” of the document structure.

The following Visual Studio extension attempts to simplify the process of determining the correct path within any document containing XML markup. This is done by displaying XPath information in the statusbar, matching the XML element or attribute at the caret position.
The XPath can be copied to the clipboard by selecting “Copy XPath” from the main menu.

The extension can be downloaded from within Visual Studio by opening “TOOLS” –> “Extensions and Updates…” and searching for “XPath”, or directly via the Visual Studio Gallery website (http://visualstudiogallery.msdn.microsoft.com/c06c7b10-41c3-4aa9-8707-570eb9d879e6).

Code

The source code can be found/forked via https://github.com/uli-weltersbach/XPathInformation.

Example

XPath information being displayed in Visual Studio status bar.

XPath information incl. XML namespace being displayed in Visual Studio status bar.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s