Automating line numbering

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

Automating line numbering

Post 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.
MacJordan
Posts: 1
Joined: Wed Nov 10, 2010 5:50 am

Re: Automating line numbering

Post 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);
}
Post Reply