Automating line numbering

Questions about XML that are not covered by the other forums should go here.
Posts: 1
Joined: Mon Oct 25, 2010 7:33 pm

Automating line numbering

Post by whatupz » Mon Oct 25, 2010 7:37 pm


I have a large XML document in TEI that contains several thousand <l n="x"> entries, as well as <lb n="x"/"> entries as well. Is there any way to automate the entry of actual numbers in sequence, since doing them all by hand would be quite tedious?

Essentially I'm looking for a way to generate
l n=1
l n=2
l n=3
etc... automatically.

Posts: 1
Joined: Wed Nov 10, 2010 5:50 am

Re: Automating line numbering

Post by MacJordan » Wed Nov 10, 2010 5:55 am

you just try,

XPathDocument doc = new XPathDocument("..\\..\\dataset1.xsd"); XPathNavigator nav = doc.CreateNavigator();
XPathNodeIterator iter = nav.Select("*");
if (iter.MoveNext()){
XPathNavigator root = iter.Current;
IXmlLineInfo info = root as IXmlLineInfo;
Console.WriteLine(info.LineNumber +"," + info.LinePosition);

Post Reply