5

With libxml2, we can use xmlGetLineNo to get the line number in which a node appears in the source XML file.

But how to get character positions of a given element and a given attribute? I need both the start and end positions in the source xml file for both a node and an attribute.

Thanks!

Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982
Edwin Yip
  • 4,089
  • 4
  • 40
  • 86

1 Answers1

2

You can use the SAX2 interface which has the xmlSAX2GetColumnNumber method.

Cito
  • 5,365
  • 28
  • 30