From: Henrik Martensson Date: 2006-04-22T06:34:44+09:00 Subject: Re: XML parser with file names and line numbers On Fri, 2006-04-21 at 00:01, David Pollak wrote: > Howdy, > > Is there a Ruby XML parser that includes the file name and line number for > elements? XML does not have the concept of a line. XML deals only with describing data and structure, not formatting. Carriage returns and line feeds are considered to be whitespace. That is why true XML editors use separate style sheets, like CSS, XSL-FO, or FOSI, to format XML documents. If you have an XML document, process it in some way, for example just by parsing it and saving it, any carriage returns and line feeds may have been removed. The parser may even add new ones. Whitespace is guaranteed to be preserved in CDATA sections only. You might find it more useful to count the elements themselves. That way the numbers won't change just because you open a file in an editor and look at it. Elements do not have file names either. What is it you want to do? /Henrik -- http://kallokain.blogspot.com/ - Blogging from the trenches of software development http://www.henrikmartensson.org/ - Reflections on software development http://tocsim.rubyforge.com/ - Process simulation http://testunitxml.rubyforge.org/ - XML test framework http://declan.rubyforge.org/ - Declarative XML processing