XML 数据集 DBUnit 中的 XML 字段
我是 dbUnit 的新手,遇到了一些问题。在我的源表中,有一列“XML_HEADER”,其内容始终采用 XML 格式。现在,我正在为测试创建一个示例数据集,并且已将字段的 XML 放入 dataset.xml 中,如下所示:
XML_HEADER="<?xml version='1.0' encoding='IBM-1140'?><Data><...></Data>"
但我收到错误:
Caused by: org.xml.sax.SAXParseException; lineNumber: 5; columnNumber: 239;
The value of attribute "XML_HEADER" associated with an element type "Table" must not contain the '<' character.
如何格式化示例数据?我是否需要进行更改才能处理传入字段?
I'm fairly new at the dbUnit and I'm facing a bit of a problem. In my source table I have a column which is "XML_HEADER", the contents of this will always be in the XML format. Now, I am creating a sample dataset for my testing and I have put the XML for the field in the dataset.xml like:
XML_HEADER="<?xml version='1.0' encoding='IBM-1140'?><Data><...></Data>"
But I'm getting the error:
Caused by: org.xml.sax.SAXParseException; lineNumber: 5; columnNumber: 239;
The value of attribute "XML_HEADER" associated with an element type "Table" must not contain the '<' character.
How do I format the sample data? Do I need to make changes in order to handle the incoming field?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将 XML 值字符串包装在 CDATA 中,例如
"<...>] ]>“
Wrap the XML value string in CDATA, e.g.
"<![CDATA[<?xml version='1.0' encoding='IBM-1140'?><Data><...>]]>"