Warning: validation was turned on but an org.xml.sax.ErrorHandler

前端 未结 3 1480
执念已碎
执念已碎 2021-01-07 02:40

Any idea why this error is happening and how to fix it? I\'m getting this error when trying to parse/load a config file:

Error

Warning: validation wa         


        
3条回答
  •  遥遥无期
    2021-01-07 03:11

    The exception says that an ErrorHandler wasn't set. This means that the parser uses its built-in error handler, which simply writes messages to the console. If you actually want to validate, you need to create an ErrorHandler implementation and attach it to the DocumentBuilder.

    For more information, read this: http://www.kdgregory.com/index.php?page=xml.parsing (error handlers are about 1/3 of the way down).

    Or, as other responses have suggested, you can just turn validation off.

提交回复
热议问题