#945 Request to include start line number in XERR

kaushik Fri 29 Jan 2010

Hi, Just a trivial feature request. When Xparser is used to parse xml documents, and throws an error, we get the end line number and col in XErr. However the start line number seems to be part of the message in the XErr and not as a saperate variable. Can we include a variable "startLine" or something that will indicate the starting line of the error? It can be null when the start line is not present.

brian Fri 29 Jan 2010

Not sure I follow - the xml::XErr class has a line and col field already?

kaushik Fri 29 Jan 2010

Sorry, my mistake, I din't explain this properly.

When parsing xml say a tag has a wrong closing.. for eg.

<div>   -->line 10
   <a>  --> line 20
</div>   --> line 30

--The XErr object thrown has line 30 in the line field, but line 20 is hard coded in the message. as per this line in XParser throw err("Expecting end of element ${elem.qname} (start line ${elem.line})", line, col)

While both line 20 and line 30 are useful to display the error message. I currently parse the message in XErr itself to get the start line number. however, It would be good to include the start line number as a instance field

brian Fri 29 Jan 2010

Ok, that makes sense.

I'll put a TODO in there for the next time I am in that code.

Login or Signup to reply.