update xml validation to conditionally create a validating parser

instead of always creating a validating parser and filtering out the dtd
errors when the document lacks a doctype declaration, conditionally set
the parser to validate only when the document has a doctype. since the
previous error filtering relied on the english version of the dtd error
messages, those errors would fail to be filtered for other locales.

fixes #296