My question: What's a good way to parse the information below?
I have a java program that gets it's input from XML. I have a feature which will send an error email if there was any problem in the processing. Because parsing the XML could be a problem, I want to have a feature that would be able to regex the emails out of the xml (because if parsing was the problem then I couldn't get the error e-mails out of the xml normally).
Requirements:
- I want to be able to parse the to, cc, and bcc attributes seperately
- There are other elements which have to, cc, and bcc attributes
- Whitespace does not matter, so my example may show the attributes on a newline, but that's not always the case.
- The order of the attributes does not matter.
Here's an example of the xml:
<error_options
to="your_email@your_server.com"
cc="cc_error@your_server.com"
bcc="bcc_error@your_server.com"
reply_to="someone_else@their_server.com"
from="bo_error@some_server.org"
subject="Error running System at @@TIMESTAMP@@"
force_send="false"
max_email_size="10485760"
oversized_email_action="zip;split_all"
>
I tried this error_options.{0,100}?to="(.*?)"
, but that matched me down to reply_to
. That made me think there are probably some cases I might miss, which is why I'm posting this as a question.