dxml behavior after exception: continue parsing

Jesse Phillips Jesse.K.Phillips+D at gmail.com
Mon May 7 22:16:58 UTC 2018


On Monday, 7 May 2018 at 19:46:00 UTC, Jesse Phillips wrote:
> So I have an XML like document which fails to adhere completely 
> to XML. One of these such events is that & is used without 
> escaping.
>
> My observation is that after the exception it is possible to 
> move to the next element without issue. Is this something 
> expected and will be maintained?
>
>
>     try {
>         range.popFront();
>     } catch (Exception e) {
>         range.popFront;
>     }

Ok so this worked when inside a quoted attribute value but not a 
normal tag body. Clearly I'm not parsing valid XML so I'm going 
outside the bounds of valid parameters. But rather than writing a 
custom parser to handle this, it would be nice to have:

      try {
          range.popFront();
      } catch (Exception e) {
          range.moveToNextTag();
      }

Which would make front a MalformedParse containing the content up 
to the next <.


More information about the Digitalmars-d-learn mailing list