My input consists of a series of label-colon-message lines:
Dear Sir: Thank you for your response
Dear Madam: How are you
Dear Foo: Have a good day
Dear Sir: Nice work
The stuff before the colon is the "label" and the stuff after the colon is the
"message".
There are two legal labels, Dear Sir and Dear Madam.
I want this output:
<Tests>
<line>
<label>Dear Sir</label>
<message>Thank you for your response</message>
</line>
<line>
<label>Dear Madam</label>
<message>How are you</message>
</line>
<line>
<label>Dear Sir</label>
<message>Nice work</message>
</line>
</Tests>
The third line (Dear Foo: Have a good day) contains invalid data (Dear Foo is
not a valid label) so I want that line discarded and an error reported for that
line and parsing to continue to the next line,
In other words, I want am error generated for erroneous data, the erroneous
data discarded, and parsing to continue.
How to do that?
/Roger