Title Image

Don Xml's Grok This

The home of Don Demsak
Welcome to Don Xml's Grok This Sign in | Help
in Search

This Blog

Syndication

Site Sponsors

DonXml's All Things Techie

XPath Queries In SharpDevelop 2.1

If imitation is the sincerest form of flattery, well then I'm very flattered.  Matt Ward announced that SharpDevelop 2.1 now has support for running XPath on the currently active XML document, and it sure looks a lot like XPathmania.  I hope I wrote it in a style that was easy to adapt to use in SharpDevelop, and I'm glad to see that it could help another open source project.  When I get a chance, maybe I'll check out what he had to do to adapt it and see if I can make it easier to share the code base.  It would be cool to have some others help with some enhancements.  The top enhancement I have right now is to make it so you can execute a query from someplace other then the root node.  The problem isn't with the code to execute it, it is in how to add it to the UI, without having to make changes to the XML Editor.  A new contextual menu item "Execute XPath Query" would probably be the best way to implement this (well that along with a key combination).
Published Sunday, August 06, 2006 3:50 PM by donxml
Filed under: , ,

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

Matt Ward said:

Hi Don,

Your XPathmania extension for Visual Studio was pointed out to me by Christophe Wille (http://chrison.net/) and I thought this would be great for SharpDevelop to have. The UI is inspired by and based on XPathmania. The code base is not the same. As far as I am aware, you use an XmlReader to read the XML, getting the line numbers for each node, and build up an XmlDocument based on this information. The SharpDevelop code uses an XPathDocument to get the line numbers:

XPathDocument doc = new XPathDocument(new StringReader(xml));
XPathNavigator navigator = doc.CreateNavigator();

XPathNodeIterator iterator = navigator.Select(xpath, namespaceManager);

while (iterator.MoveNext()) {
// Store line info...
IXmlLineInfo info = iterator.Current as IXmlLineInfo;
}

Regards,

Matt.
August 7, 2006 7:51 AM

Leave a Comment

(required) 
(optional)
(required) 
Submit

About donxml

I’m an independent consultant, specializing in .Net solutions architecture, based out of New Jersey who also doubles as an evangelist for XML, Domain Driven Design, enterprise architecture and .Net. I do not work for Microsoft, the W3C or any other big company that you may know of (at least not yet). I’ve been an indie for over ten years, and although I’ve been tempted a couple times to take a job with companies like Microsoft, I’ve haven’t found something better than my current situation. I work mostly with the large pharmaceuticals that are based here in New Jersey, and usually find myself on long term contracts. Definitely not the prototypical indie consultant, but it lets me dedicate time to my non-income generating activities like the developer community stuff, plus financing open source projects like XPathmania and MVP-XML. If you would like to talk to me about doing some contract work, just contact me via the contact page. My rates vary widely, depending on lots of different variables, but mostly distance from Jersey, and type of work. Plus, I’ve been known to donate some of my code for various projects.
Powered by Community Server, by Telligent Systems