Mal-formatted XML

75 views
Skip to first unread message

Nader Mirzadeh

unread,
Jan 15, 2014, 8:39:47 AM1/15/14
to bea...@googlegroups.com
Hi,
I run into a case which is when an input XML is mal-formatted. More precisely, the value of one of attributes in the XML document contains double quote. I've also handle the exception, and proceed to read next record. When there's mal-formatted data like <my-element my-attribute="this is mal-"fomratted" data"/> BeanIO throws
MalformedRecordException, but the cursor doesn't move to the next record. The very next read would throw the same exception. In short, reading the mal-formatted XML document would never finishes. This case is happening in our production environment.

Regards,
  Nader Mirzadeh

Kevin

unread,
Jan 16, 2014, 9:53:09 PM1/16/14
to bea...@googlegroups.com
BeanIO is not an XML parser, and therefore requires well-formed XML for processing.  I recommend in the reference guide that XML documents are validated for syntax and ideally against an XML schema before processing by BeanIO.  Its up to you of course, but I don't think partially processing an invalid document is a good idea.

Thanks,
Kevin

Nader Mirzadeh

unread,
Jan 17, 2014, 6:50:35 AM1/17/14
to bea...@googlegroups.com
Thanks Kevin for clarification.

Regards,
  Nader
Reply all
Reply to author
Forward
0 new messages