Extraction of XPath selection results

Apr 14, 2010 at 4:01 PM

Hello again,

I brought up this discussion some time ago via the issue tracker.

I asked about a functionality to extract all nodes matching the XPath expression to e.g. paste them into new file via an editor, or to replace the current XML document by these selected nodes.

I just tested another XML related codeplex project named XML Explorer (http://xmlexplorer.codeplex.com) and it has such a functionality.
It opens just a new tab containing the selected nodes allowing to copy/cut/save them or to do a next XPath selection.

May be it could worth taking a look at this and to introduce this in the XPathVisualizer?

Thanks in advance for taking part within this discussion!

Best regards,

Martin Lemburg

Apr 14, 2010 at 8:09 PM

Yes, I remember you asked for this function, Martin.

I will take a look.   What version of XML Explorer includes this capability?  Do I need the .NET Framework 4.0? 

Also, don't take this the wrong way, but... I want to ask....   if XML Explorer does what you want.... , then why do you want the feature in XPathVisualizer?




Apr 14, 2010 at 8:12 PM

ps: I really like the tabbed interfacte on XML Explorer - it looks very professional.


Apr 15, 2010 at 9:38 AM

Hello Cheeso,

I like small fingerprint of XPathVisualizer, which could be (not thinking of the dependencies to .NET) made "portable".

The XML Explorer was long time in a very "unstable" state! Now the version 4 is coming, not really bringing really new features, but a complete reworked UI and hopefully more stability!

So ... I have XPathVisualizer on my USB Stick to work with it, because it's handling is simple, the way to work with XPath results is easy, even if I have still thoughts for improvements.

Back to your question, if you need XML Explorer 4 with .NET 4 - I don't know, because I never looked it its sources, neither I asked the author.
But ... this feature is quit old, so I expect it should work with .NET 3.+ or even with .NET 2.

Perhabs you could ask him, - if the sources are not clean enough organized to see it.

Thanks for your engagement!

Best regards,


Apr 15, 2010 at 7:51 PM

Ah, I understand. 

Apr 19, 2010 at 3:16 PM

Hello, Martin,

I've updated XPathVisualizer with a new "Extract" capability.

Tell me what you think.  You need v1.2.1.0 to see it.



Apr 19, 2010 at 3:57 PM

Thanks Cheeso for implementing this new feature and the tabs!

Only "one" comment or suggestion - if attributes are selected via a XPath expression like "//@*[string-length() > 5]", than extracting this selection results will last in something not really usable - a simply concatenated string below the root node in this way:


Since XPathVisualizer does not handle attributes as nodes or objects while evaluating XPath expressions, why not handle them as nodes in an extraction result?


Or the original nodes are used:

       <node1 attribute1Name="attribute1Value>...
       <node2 attribute2Name="attribute2Value" attribute3Name="attribute3Value">...

I think to select only attributes the first extraction would be the finest, because it will enable to handle the attributes as XML data.

What do you think?

Best regards,


Apr 19, 2010 at 4:15 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Apr 19, 2010 at 5:12 PM

Martin your idea sounds reasonable.

I put it into v1.2.1.1, which is now available.

There are still some gotchas - for example if you have an Xhtml file, and you extract, it's possible to have entity references in the extracted portion.  The DTD is not copied over to the extracted document, so those entities will be unknown, unless you manually add the XHTML DTD.