I need to retrieve the line and col number of an xml document when I m parsing it on vb.net; here is an example:
xml:
<?xml version = "1,0"encoding = "utf-8"?> <!-- line 1 --> <user> <!-- line 2 --> <name>dave</name> <!-- line 3 --> <age>29</age> <!-- line 4 --> <function>medic</function> <!-- line 5 --><!-- col 8 --> </user> <!-- line 6 -->
vb:
Dim xelement As XElement = xelement.load(xmlDocName) xmlDocName is the path of the document Dim nodes = from data in xelement.elements("user") for each xEle in nodes name = xEle.Elements.("name").value.toString age = xEle.Elements.("age").value.toString func = xEle.Elements.("function").value.toString if func = string.empty then Here is my problem: I need some thing like that: line = xEle.Elements.("age").lineNumber.toString the variable line should receve the value 5 col = xEle.Elements.("age").colNumber.toString the variable col should receve the value 8 But those methods does not exist... end if next
I need an help using the XElement class, if it is not possible I will have to change it.