Page 1 of 1

Automating line numbering

Posted: Mon Oct 25, 2010 7:37 pm
by whatupz
Hello!

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.

Re: Automating line numbering

Posted: Wed Nov 10, 2010 5:55 am
by MacJordan
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);
}