Re: [xml] parsing fragments of a larger file



Aaron Optimizer Digulla wrote:
> This solves a big mystery for me: Why almost no XML tool
> provides useful error messages. I think libxml2 is the only
> XML tool which will specify the line/column of the offending
> *start* element when start and end mismatch (to understand the
> joke here: Think of an XML file with 200 elements. One of them
> is wrong in such a way that the last element doesn't match.
> Good luck finding the mismatch manually...).

<one>
  <two>
    <three>
      ...
    </three>
  </two>
</not-one>

xmllint reports both line numbers (at least to humans):

 -:7: error: Opening and ending tag mismatch: one line 1 and not-one
 </not-one>
          ^

... as does Saxon('s XML parser):

 Error on line 7
   Error reported by XML parser: "</one>" zum Abschließen des Elements
   auf Zeile 1 erwartet

RXP reports the line number of the mismatched end tag:

 Error: Mismatched end tag: expected </one>, got </not-one>
  in unnamed entity at line 7 char 10 of <stdin>

Tobi

--
http://www.pinkjuice.com/






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]