XPath: select specific node which has namespace

Viewed 2737

I need to select a node in an xml document, but the node in the level above it has a namespace. How to do this?

Part of my xml file:

<SW.DataBlock ID="0">
<AttributeList>
  <DatablockType>SharedDB</DatablockType>
  <Interface>
    <Sections xmlns="http://www.siemens.com/automation/Openness/SW/Interface/v1">
        <Section Name="Static">
            <Member Name="DbBool1" Datatype="Bool" />
            <Member Name="DbA" Datatype="&quot;DataTypeA&quot;" />
            <Member Name="AddedDbB" Datatype="&quot;DataTypeB&quot;" />
        </Section>
    </Sections>
  </Interface>
  <MemoryLayout>Standard</MemoryLayout>
  <Name>DataA</Name>
  <Number>1</Number>
  <ProgrammingLanguage>DB</ProgrammingLanguage>
  <Type>DB</Type>
</AttributeList>
</SW.DataBlock>

It is the 'section' node which I need to get. Because of the namespace, the statement:

node2 = node.SelectSingleNode("//Section")

does not work. What do I need to put in place of the "//Section" part to make it work?

Edit: I use vb.Net with the System.Xml Package

1 Answers
Related