1 /*
2 * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
24 package transform;
25
26 import java.io.StringReader;
27 import java.io.StringWriter;
28 import java.util.Properties;
29
30 import javax.xml.parsers.DocumentBuilder;
31 import javax.xml.parsers.DocumentBuilderFactory;
32 import javax.xml.transform.OutputKeys;
33 import javax.xml.transform.Transformer;
34 import javax.xml.transform.TransformerFactory;
35 import javax.xml.transform.dom.DOMResult;
36 import javax.xml.transform.dom.DOMSource;
37 import javax.xml.transform.stream.StreamResult;
38 import javax.xml.transform.stream.StreamSource;
39
40 import org.w3c.dom.Document;
41 import org.w3c.dom.DocumentFragment;
42
43 import org.testng.Assert;
44 import org.testng.annotations.Test;
45
46 /*
47 * @summary Test XSL extension for RTF works, for https://issues.apache.org/jira/i#browse/XALANJ-2290.
48 */
49 public class Issue2290Test {
50
51 @Test
52 public final void testTransform() throws Exception {
53 DocumentFragment outNode = null;
54 DocumentBuilder docBuilder = null;
55 Document outDoc = null;
56 // TransformerImpl transformer = null;
57 StringReader execReaderXML = null;
58 Properties propFormat = null;
59 StringWriter sw = null;
60
61 try {
62 // template = TransformerFactory.newInstance().newTemplates(new
63 // StreamSource("D:/Work/Apache/TestVar.xsl"));
64 // transformer = (TransformerImpl) template.newTransformer();
65 Transformer t = TransformerFactory.newInstance().newTransformer(new StreamSource(getClass().getResourceAsStream("Issue2290.xsl")));
66 System.out.print("Created Transformer");
67 execReaderXML = new StringReader("<?xml version=\"1.0\"?> <doc>Stuff</doc>");
68
|
1 /*
2 * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
24 package transform;
25
26 import java.io.StringReader;
27 import java.io.StringWriter;
28 import java.util.Properties;
29
30 import javax.xml.parsers.DocumentBuilder;
31 import javax.xml.parsers.DocumentBuilderFactory;
32 import javax.xml.transform.OutputKeys;
33 import javax.xml.transform.Transformer;
34 import javax.xml.transform.TransformerFactory;
35 import javax.xml.transform.dom.DOMResult;
36 import javax.xml.transform.dom.DOMSource;
37 import javax.xml.transform.stream.StreamResult;
38 import javax.xml.transform.stream.StreamSource;
39
40 import org.w3c.dom.Document;
41 import org.w3c.dom.DocumentFragment;
42
43 import org.testng.Assert;
44 import org.testng.annotations.Listeners;
45 import org.testng.annotations.Test;
46
47 /*
48 * @summary Test XSL extension for RTF works, for https://issues.apache.org/jira/i#browse/XALANJ-2290.
49 */
50 @Listeners({jaxp.library.FilePolicy.class})
51 public class Issue2290Test {
52
53 @Test
54 public final void testTransform() throws Exception {
55 DocumentFragment outNode = null;
56 DocumentBuilder docBuilder = null;
57 Document outDoc = null;
58 // TransformerImpl transformer = null;
59 StringReader execReaderXML = null;
60 Properties propFormat = null;
61 StringWriter sw = null;
62
63 try {
64 // template = TransformerFactory.newInstance().newTemplates(new
65 // StreamSource("D:/Work/Apache/TestVar.xsl"));
66 // transformer = (TransformerImpl) template.newTransformer();
67 Transformer t = TransformerFactory.newInstance().newTransformer(new StreamSource(getClass().getResourceAsStream("Issue2290.xsl")));
68 System.out.print("Created Transformer");
69 execReaderXML = new StringReader("<?xml version=\"1.0\"?> <doc>Stuff</doc>");
70
|