當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。