Quantcast
Channel: XML, System.Xml, MSXML and XmlLite forum
Viewing all articles
Browse latest Browse all 935

xml namespace resolver for Visio 2013 XML

$
0
0

Visio 2013 creates an XML file like:

<?xml version='1.0' encoding='utf-8' ?>
<PageContents xml:space='preserve'
       xmlns='http://schemas.microsoft.com/office/visio/2012/main'
       xmlns:r='http://schemas.openxmlformats.org/officeDocument/2006/relationships' >
 <Shapes>  etc., etc.

The code below selects zero nodes:

var doc = new XPathDocument(Filename);
XPathNavigator nav = doc.CreateNavigator();
XPathNodeIterator nodes = nav.Select("/PageContents/Shapes/Shape[@Master='9']", nav);

If I edit the XML file to change "xmlns='http" to "xmlns:x='http" I get 4 nodes selected.
How do I code my method such that it works without having to edit the source XML file?


Viewing all articles
Browse latest Browse all 935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>