【问题标题】:Ignore Case with XMLUnit使用 XMLUnit 忽略大小写
【发布时间】:2012-03-29 16:54:57
【问题描述】:

在比较两个 XML 文档时,有没有办法让 XML 单元忽略大小写?标签和它们的值......对我来说和我一样吗?

XMLUnit 给我以下区别:Expected attribute value 'FALSE' but was 'false'

我尝试在两个输入字符串上简单地使用.toUpperCase(),但随后出现此错误:

[Fatal Error] :1:6: The processing instruction target matching "[xX][mM][lL]" is not allowed. org.xml.sax.SAXParseException: The processing instruction target matching "[xX][mM][lL]" is not allowed. at org.apache.xerces.parsers.DOMParser.parse(Unknown Source) at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source) at org.custommonkey.xmlunit.XMLUnit.buildDocument(XMLUnit.java:383) at org.custommonkey.xmlunit.XMLUnit.buildDocument(XMLUnit.java:370) at org.custommonkey.xmlunit.Diff.<init>(Diff.java:101) at org.custommonkey.xmlunit.Diff.<init>(Diff.java:93)

有什么不同的方法可以做到这一点吗?或者有办法摆脱错误?

【问题讨论】:

    标签: java xml xmlunit


    【解决方案1】:

    所以,如果我使用.toLowerCase(),它会起作用...与 Doctype 大写有关的事情会导致问题或类似的事情...

    【讨论】:

    • 尽管如此,告诉 XMLUnit 忽略大小写的方法会很酷:)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-09-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多