|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Determining the line number in XML sourceIn my applications, there are several areas where I am parsing some XML input. Whoever has prepared that XML, be it machine, or human, errors happen, and the format is bad. When the XML itself is bad, the built-in XML parser informs about the line and column where the problem has occured. However, the XML may be valid, but the data that are within, not valid. And I am talking about run-time invalidity, rather than schema invalidity. So, error may occur at runtime, when specific data are passed to the method that works with certain input thas is in XML. If error accours, I'd like to know, not only at which element it happened (I know it naturally, because I work with the XML node tree), but also in which line this node is specified in the original XML input (let's assume I work with the input data without touching it). Does the built-in parser holds some memory about this? Or, am I doomed to write some sort or walker that reopens the file and walks over it to find the appropriate node, and reports the line and column number? Thanks, Pavils |
|||||||||||||||||||||||