How to Get XMLNode From an XML File by using C# and the LineNumber without using LINQ->XML -


i wonder if there way xmlnode of xml document knowing have line number, use c# , don't want use linq (xdocument) need xmlnode xmldocument. exemple if have xml :

<document> <a key="1">aaa</a> <a key="2">aa</a> <a key="3">aaa></a> <a key="4">aa></a> <b key="15">bbbb></b> </document> 

i excepect have function that take input line number 4 , return

<a key="3">aaa></a> 

all without using linq (only using xmldocument , xmlnode syntaxes...and not xdocument..) thank in advance


to more specific need balise , not line exemple if xml :

1. <document> 2. <a key="1">aaa</a> 3. <a key="2">aa</a> 4. <a key="3"> 5. aaa 6. </a> 7. <a key="4">aa></a> 8. <b key="15">bbbb></b> 9. </document> 

i excepect have function that take input line number 4 or 5 or 6 return :

<a key="3">aaa</a> 

you reading string text in , grabbing lines want too. string , not xmlnode.

to xmldocument need select root node, , index children of node -1 line node taking.

        xmlnode root = doc.selectsinglenode("//document");         xmlnode nodeiwant = root.childnodes[line - 1]; 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

jsf - How to ajax update an item in the footer of a PrimeFaces dataTable? -

django - CSRF verification failed. Request aborted. CSRF cookie not set -