Menu

#27 error reporting by the parser

v4.2.10
closed-fixed
Parsing (4)
5
2018-09-17
2018-09-12
Alex K.
No

xml 1.

<FATHER>
</FATHER>
<x>

xml 2.

<x>
<FATHER>
</FATHER>

parser do not report any error


xml 3.

<FATHER>
<x y="t>tekst</x>
</FATHER>
<FATHER2>
</FATHER2>

on the line with the missing quotation mark (line nr 2) parser do not reports error ,
but on the end of file (line nr 5):

test.xml:5: An error was found (UNEXPECTED_END_OF_FILE(-4)), loading aborted...
Error while loading

Discussion

  • Matthieu Labas

    Matthieu Labas - 2018-09-12
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,4 +1,3 @@
    -
     xml 1.
    
     ~~~
    
    • status: open --> pending
    • Group: v4.2.9 --> v4.2.10
     
  • Matthieu Labas

    Matthieu Labas - 2018-09-12

    This is (somehow) expected behaviour:

    sxmlc was designed to handle multiple root nodes, so both xml1 and xml2 are showing two root nodes. However, one of them is not finished so a warning could be raised. I'll prepare a feature request on that.

    The error reported in xml3 was expected as I remember I read in some specs that > was legal in XML attribute values. However, I can't find that anymore, but could find several links showing it was illegal. As I want sxmlc to be as permissive as possible (i.e. be able to parse malformed XML data (to some extent)), I will think about the easiest way to solve that. The example you show clearly is a missing quote, so I think I'll just report an error when <> are in the attributes.

     
  • Matthieu Labas

    Matthieu Labas - 2018-09-17
    • status: pending --> closed-fixed
     
  • Matthieu Labas

    Matthieu Labas - 2018-09-17

    Fixed in v4.2.10.
    Though parser will not report an error on unfinished root tags. At the moment it should be considered a warning: SAX will stop parsing and the caller should check that open nodes were not finished; DOM will just leave nodes as they are (i.e. no new nodes are added to the "unfinished" nodes, though there are no way to know they were not finished).

     

Log in to post a comment.

MongoDB Logo MongoDB