0

I have a XML file which contain this code:

more information
    +<RoutePoints z:Id="410" z:Size="8">...</RoutePoints>
more information

I need to access to value of z:id, I think should be something like this:

xmlDocument = XElement.load(pathfile);
var ns = xmlDocument.getDefaultNamespace();
int id = (int)xmlDocument.Descendants( ns + "RoutePoints").Attribute....;

Could you help me to access z:Id value? If it is possible by prefix and attribute?

JoseJimRin
  • 372
  • 1
  • 4
  • 20

1 Answers1

0

I found the solution for my question. It is necessary to generate a variable with name of prefix and access with function Atributtes like that:

var z = xmlDocument.getNamespaceOfPrefix("z");
var id = xmlDocument.Descendants( ns + "RoutePoints").Attributes( z + "Id").Value;
JoseJimRin
  • 372
  • 1
  • 4
  • 20