带有“Unexpected element:CDATA”消息的org.apache.xmlbeans.XmlException是什么?意思? [英] What does the org.apache.xmlbeans.XmlException with a message of "Unexpected element: CDATA" mean?

查看:2356
本文介绍了带有“Unexpected element:CDATA”消息的org.apache.xmlbeans.XmlException是什么?意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试解析并加载XML文档,但是当我在扩展XmlObject的类上调用parse方法时,我遇到了这个异常。不幸的是,它没有让我知道哪个元素是意外的,这是我的问题。

I'm trying to parse and load an XML document, however I'm getting this exception when I call the parse method on the class that extends XmlObject. Unfortunately, it gives me no ideas of what element is unexpected, which is my problem.

我无法分享这个代码,但我可以尝试提供如有必要,请提供更多信息。

I am not able to share the code for this, but I can try to provide more information if necessary.

推荐答案

无法共享代码或输入数据,您可以考虑以下方法。这是一种非常常见的二分法诊断方法,我很害怕,事实上你可能已经开始了......

Not being able to share code or input data, you may consider the following approach. That's a very common dichotomic approach to diagnostic, I'm afraid, and indeed you may readily have started it...

尝试并减少通过删除部分输入XML的大小来确保输入XML的大小,确保底层XML文档保持良好形式并且可能有效(如果解析器的设置需要有效性)。如果你保持有效性,这可能需要改变模式(DTD或其他)的[副本],因为在剪切和尝试方法期间可能会删除要求... ...顺便说一句,错误消息似乎暗示更多一个基本的良构性断言问题的验证问题。

Try and reduce the size of the input XML by removing parts of it, ensuring that the underlying XML document remains well formed and possibly valid (if validity is required in your parser's setup). If you maintain validity, this may require to alter [a copy of] the Schema (DTD or other), as manditory elements might be removed during the cut-and-try approach... BTW, the error message seems to hint more at a validation issue that a basic well-formedness assertion issue.

除非对触发解析器投诉的区域有特别的预感,否则我们通常会删除(或重新添加,当事情开始工作时)大约是先前削减或重新添加的一半。

Unless one has a particular hunch as to the area that triggers the parser's complaint, we typically remove (or re-add, when things start working) about half of what was previously cut or re-added.

你也可以从尝试一个基本上空的文件开始,断言解析器确实可以工作......还有一个想法是划分为优先级:是XML输入或解析器中的问题? (记住可能有两个问题,一个在输入中,一个在解析器中,而且这些问题甚至可能是无关的......)

You may also start with trying a mostly empty file, to assert that the parser does work at all... There again is the idea to "divide to prevail": is the issue in the XML input or in the parser ? (remembering that there could be two issues, one in the input and one in the parser, and thtat such issues could even be unrelated...)

抱歉belabor basic诊断技术,你可以很流利...

Sorry to belabor basic diagnostics techniques which you may well be fluent with...

这篇关于带有“Unexpected element:CDATA”消息的org.apache.xmlbeans.XmlException是什么?意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆