当前位置: 首页>>代码示例>>Java>>正文


Java XMLUnit.setIgnoreDiffBetweenTextAndCDATA方法代码示例

本文整理汇总了Java中org.custommonkey.xmlunit.XMLUnit.setIgnoreDiffBetweenTextAndCDATA方法的典型用法代码示例。如果您正苦于以下问题:Java XMLUnit.setIgnoreDiffBetweenTextAndCDATA方法的具体用法?Java XMLUnit.setIgnoreDiffBetweenTextAndCDATA怎么用?Java XMLUnit.setIgnoreDiffBetweenTextAndCDATA使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.custommonkey.xmlunit.XMLUnit的用法示例。


在下文中一共展示了XMLUnit.setIgnoreDiffBetweenTextAndCDATA方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: assertXMLEquals

import org.custommonkey.xmlunit.XMLUnit; //导入方法依赖的package包/类
public static void assertXMLEquals(String expectedXML, String actualXML) throws Exception {
    XMLUnit.setIgnoreWhitespace(true);
    XMLUnit.setIgnoreDiffBetweenTextAndCDATA(true);
    XMLUnit.setIgnoreAttributeOrder(true);

    DetailedDiff diff = new DetailedDiff(XMLUnit.compareXML(expectedXML, actualXML));

    List<?> allDifferences = diff.getAllDifferences();
    Assert.assertEquals("Differences found: "+ diff.toString(), 0, allDifferences.size());
}
 
开发者ID:hashmapinc,项目名称:WitsmlObjectsLibrary,代码行数:11,代码来源:TestUtilities.java

示例2: isXMLEqual

import org.custommonkey.xmlunit.XMLUnit; //导入方法依赖的package包/类
protected void isXMLEqual(Document control, Document test)
		throws SAXException, IOException {
	XMLUnit.setIgnoreWhitespace(true);
	XMLUnit.setIgnoreAttributeOrder(true);
	XMLUnit.setIgnoreComments(true);
	XMLUnit.setIgnoreDiffBetweenTextAndCDATA(true);
	// XMLUnit.setNormalize(true);

	// Diff diff = compareXML (control, test);

	assertXMLEqual(control, test);
}
 
开发者ID:EXIficient,项目名称:exificient,代码行数:13,代码来源:DOMRoundtrip.java

示例3: testEString

import org.custommonkey.xmlunit.XMLUnit; //导入方法依赖的package包/类
private byte[] testEString(String xmlAsString) throws EXIException, IOException, SAXException, TransformerException {
	/* DTR Map */
	QName type = new QName("", "es");
	QName representation = new QName(Constants.W3C_EXI_NS_URI, "estring");
	QName[] dtrMapTypes = { type };
	QName[] dtrMapRepresentations = { representation };
	
	// factory
	EXIFactory ef = DefaultEXIFactory.newInstance();
	ef.setFidelityOptions(FidelityOptions.createStrict());
	ef.setGrammars(GrammarFactory.newInstance().createGrammars(new ByteArrayInputStream(xsdAsStringEString.getBytes())));
	ef.setDatatypeRepresentationMap(dtrMapTypes, dtrMapRepresentations);
	
	// encode 
	ByteArrayOutputStream baos = new ByteArrayOutputStream();
	EXIResult exiResult = new EXIResult(ef);
	exiResult.setOutputStream(baos);
	XMLReader xmlReader = XMLReaderFactory.createXMLReader();
	xmlReader.setContentHandler( exiResult.getHandler() );
	xmlReader.parse(new InputSource(new ByteArrayInputStream(xmlAsString.getBytes()))); // parse XML input
	
	
	
	// decode
	ByteArrayOutputStream baosXML = new ByteArrayOutputStream();
	Result result = new StreamResult(baosXML);
	InputSource is = new InputSource(new ByteArrayInputStream(baos.toByteArray()));
	SAXSource exiSource = new EXISource(ef);
	exiSource.setInputSource(is);
	TransformerFactory tf = TransformerFactory.newInstance();
	Transformer transformer = tf.newTransformer();
	transformer.transform(exiSource, result);
	
	// System.out.println(new String(baosXML.toByteArray()));
	
	XMLUnit.setIgnoreWhitespace(true);
	XMLUnit.setIgnoreAttributeOrder(true);
	XMLUnit.setIgnoreDiffBetweenTextAndCDATA(true);
	
	XMLAssert.assertXMLEqual(new StringReader(xmlAsString), new StringReader(new String(baosXML.toByteArray())));
	
	return baos.toByteArray();
}
 
开发者ID:EXIficient,项目名称:exificient,代码行数:44,代码来源:DtrMapTestCase.java


注:本文中的org.custommonkey.xmlunit.XMLUnit.setIgnoreDiffBetweenTextAndCDATA方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。