我正在构建一个从服务器下载xml文档的应用。我发现某些文档格式错误,并且会产生问题。有没有办法检查xml文档格式是否正确?
Codename Ones XML解析器最初设计为SGML解析器,因此无法验证。这也提高了解析性能。
它仍然会发送错误回调,您可以通过重写来拦截:
protected void notifyError(int errorId,String tag, String attribute,String value,String description)
或通过实现ParserCallback
接口。由于XML中的某些语义错误,可能不会发送它们。