1 7 8 package org.dom4j; 9 10 import junit.textui.TestRunner; 11 12 18 public class NormalizeTest extends AbstractTestCase { 19 public static void main(String [] args) { 20 TestRunner.run(NormalizeTest.class); 21 } 22 23 public void testNormalize() throws Exception { 26 String text = document.asXML(); 27 28 document.normalize(); 29 30 String normalizedText = document.asXML(); 31 32 log("Initial: " + text); 33 log("Normalized: " + normalizedText); 34 35 String value = document.valueOf("/dummy/full"); 36 assertEquals("Should not trim text", " node ", value); 37 } 38 39 protected void setUp() throws Exception { 42 super.setUp(); 43 44 String xml = "<dummy> <full> node </full> with text " 45 + "<and>another node</and> </dummy>"; 46 document = DocumentHelper.parseText(xml); 47 } 48 } 49 50 86 | Popular Tags |