I have the following XML document, and I've been using XPath to navigate this and other documents without issues. But one of the elements has an attribute with a namespace that I can't seem to navigate to with XPath.
<Pages xmlns='http://schemas.microsoft.com/office/visio/2012/main' xmlns:r='http://schemas.openxmlformats.org/officeDocument/2006/relationships' xml:space='preserve'>
<Page ID='33' NameU='Background-1' Name='Background-1' Background='1' ViewScale='0.75' ViewCenterX='4' ViewCenterY='2'>
<PageSheet LineStyle='0' FillStyle='0' TextStyle='0' UniqueID='{0}'>
<Cell N='PageWidth' V='11' U='MM'/>
<Section N='Layer'>
<Row IX='0'>
<Cell N='Name' V='Background'/>
</Row>
<Row IX='1'>
<Cell N='Name' V='Watermark'/>
</Row>
</Section>
</PageSheet>
<Rel r:id='rId1'/>
</Page>
</Pages>
I've used XPath to select elements and attributes but I can't get it to work with an attribute that has a namespace. I have my NameSpaceManager set up like this
XmlNamespaceManager nsm = new XmlNamespaceManager(new NameTable());
nsm.AddNamespace("xVis", "http://schemas.microsoft.com/office/visio/2012/main");
nsm.AddNamespace("xRel", "http://schemas.openxmlformats.org/package/2006/relationships");
And I've no problems getting attributes like ID, NameU and so on using XPath like
XPathSelectElement(".//xVis:Page[@NameU='something']", nsm);
But I can't get it to work when the attribute has a namespace like the r:id attribute
XPathSelectElement(".//xVis:Page/xVis:Rel[@xRel:id='rid1']", nsm);
This XPath doesn't return anything, and neither does it if I skip the NS declaration.
How do I access this attribute?