File tree Expand file tree Collapse file tree 4 files changed +431
-14
lines changed Expand file tree Collapse file tree 4 files changed +431
-14
lines changed Original file line number Diff line number Diff line change @@ -50,7 +50,8 @@ type Node struct {
5050 NamespaceURI string
5151 Attr []Attr
5252
53- level int // node level in the tree
53+ level int // node level in the tree
54+ LineNumber int // line number where this node appears in the source XML
5455}
5556
5657type outputConfiguration struct {
@@ -122,6 +123,11 @@ func (n *Node) Level() int {
122123 return n .level
123124}
124125
126+ // GetLineNumber returns the line number where this node appears in the source XML.
127+ func (n * Node ) GetLineNumber () int {
128+ return n .LineNumber
129+ }
130+
125131// InnerText returns the text between the start and end tags of the object.
126132func (n * Node ) InnerText () string {
127133 var output func (* strings.Builder , * Node )
Original file line number Diff line number Diff line change 66)
77
88type ParserOptions struct {
9- Decoder * DecoderOptions
9+ Decoder * DecoderOptions
10+ WithLineNumbers bool
1011}
1112
1213func (options ParserOptions ) apply (parser * parser ) {
You can’t perform that action at this time.
0 commit comments