Tengo este documento XML con espacios de nombres y quiero extraer algunos nodos con XPath.XPath en un documento XML con espacio de nombres
Aquí está el documento:
<ArrayOfAnyType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/">
<anyType xsi:type="Document">
<Id>5</Id>
<Title>T1</Title>
</anyType>
<anyType xsi:type="Document">
<Id>15</Id>
<Title>T15</Title>
</anyType>
</ArrayOfAnyType>
¿Cuál es la expresión XPath va a ser si quiero extraer todos los elementos "anyType" con xsi: type = "Documento"?
He intentado esto:
//anyType[@xsi:type="Document"]
y no funciona:
la versión de XPath se utiliza? Las versiones xpath manejan espacios de nombres de manera diferente? –
Parece que tengo que decir: '// xmlns: anyType [@xsi: type = "Document"]' para que funcione – EnToutCas
Duped: - http://stackoverflow.com/questions/536441/xpath-namespace-driving -me-crazy - http://stackoverflow.com/questions/11345/xpaths-and-default-namespaces - http://stackoverflow.com/questions/103576/whats-wrong-with-my-xpath-xml – annakata