1 7 8 package org.dom4j.io; 9 10 import junit.textui.TestRunner; 11 12 import java.io.StringWriter ; 13 14 import javax.xml.transform.Transformer ; 15 import javax.xml.transform.TransformerFactory ; 16 import javax.xml.transform.stream.StreamResult ; 17 18 import org.dom4j.AbstractTestCase; 19 import org.dom4j.Document; 20 import org.dom4j.DocumentHelper; 21 22 27 public class DocumentSourceTest extends AbstractTestCase { 28 public static void main(String [] args) { 29 TestRunner.run(DocumentSourceTest.class); 30 } 31 32 public void testBug555549() throws Exception { 35 String xml = "<field id='Description' type='textarea'>line1" 37 + (char) 13 + (char) 10 + "line2</field>"; 38 Document doc = DocumentHelper.parseText(xml); 39 TransformerFactory tf = TransformerFactory.newInstance(); 40 Transformer txml = tf.newTransformer(); 41 StringWriter writer = new StringWriter (); 42 txml.transform(new DocumentSource(doc), new StreamResult (writer)); 43 44 System.out.println(writer.toString()); 45 assertTrue(writer.toString().indexOf("
") == -1); 46 } 47 } 48 49 85 | Popular Tags |