Lines 32-40
Link Here
|
32 |
|
32 |
|
33 |
import java.io.InputStream; |
33 |
import java.io.InputStream; |
34 |
import java.io.OutputStream; |
34 |
import java.io.OutputStream; |
35 |
import java.io.BufferedInputStream; |
35 |
import java.io.StringWriter; |
36 |
import java.io.ByteArrayOutputStream; |
36 |
import java.io.ByteArrayOutputStream; |
37 |
import java.io.ByteArrayInputStream; |
|
|
38 |
import java.io.IOException; |
37 |
import java.io.IOException; |
39 |
|
38 |
|
40 |
|
39 |
|
Lines 42-52
Link Here
|
42 |
import javax.xml.parsers.DocumentBuilder; |
41 |
import javax.xml.parsers.DocumentBuilder; |
43 |
import javax.xml.parsers.ParserConfigurationException; |
42 |
import javax.xml.parsers.ParserConfigurationException; |
44 |
|
43 |
|
|
|
44 |
import javax.xml.transform.TransformerFactory; |
45 |
import javax.xml.transform.Transformer; |
46 |
import javax.xml.transform.stream.StreamResult; |
47 |
import javax.xml.transform.dom.DOMSource; |
48 |
|
45 |
import org.w3c.dom.Node; |
49 |
import org.w3c.dom.Node; |
46 |
import org.w3c.dom.Element; |
50 |
import org.w3c.dom.Element; |
47 |
import org.w3c.dom.Document; |
51 |
import org.w3c.dom.Document; |
48 |
import org.xml.sax.SAXException; |
52 |
import org.xml.sax.SAXException; |
49 |
import org.xml.sax.SAXParseException; |
|
|
50 |
|
53 |
|
51 |
import org.openoffice.xmerge.util.Resources; |
54 |
import org.openoffice.xmerge.util.Resources; |
52 |
import org.openoffice.xmerge.util.Debug; |
55 |
import org.openoffice.xmerge.util.Debug; |
Lines 65-73
Link Here
|
65 |
/** DOM <code>Document</code> of content.xml. */ |
68 |
/** DOM <code>Document</code> of content.xml. */ |
66 |
private Document contentDoc = null; |
69 |
private Document contentDoc = null; |
67 |
|
70 |
|
68 |
/** DOM <code>Document</code> of content.xml. */ |
|
|
69 |
private Document styleDoc = null; |
70 |
|
71 |
private String documentName = null; |
71 |
private String documentName = null; |
72 |
private String fileName = null; |
72 |
private String fileName = null; |
73 |
private String fileExt = null; |
73 |
private String fileExt = null; |
Lines 258-263
Link Here
|
258 |
java.lang.reflect.Method meth; |
258 |
java.lang.reflect.Method meth; |
259 |
|
259 |
|
260 |
String domImpl = doc.getClass().getName(); |
260 |
String domImpl = doc.getClass().getName(); |
|
|
261 |
|
262 |
System.err.println("type b " + domImpl); |
261 |
|
263 |
|
262 |
/* |
264 |
/* |
263 |
* We may have multiple XML parsers in the Classpath. |
265 |
* We may have multiple XML parsers in the Classpath. |
Lines 331-337
Link Here
|
331 |
} |
333 |
} |
332 |
else { |
334 |
else { |
333 |
// We dont have another parser |
335 |
// We dont have another parser |
334 |
throw new IOException("No appropriate API (JAXP/Xerces) to serialize XML document: " + domImpl); |
336 |
try { |
|
|
337 |
DOMSource domSource = new DOMSource(doc); |
338 |
StringWriter writer = new StringWriter(); |
339 |
StreamResult result = new StreamResult(writer); |
340 |
TransformerFactory tf = TransformerFactory.newInstance(); |
341 |
Transformer transformer = tf.newTransformer(); |
342 |
transformer.transform(domSource, result); |
343 |
return writer.toString().getBytes(); |
344 |
} |
345 |
catch (Exception e) { |
346 |
// We don't have another parser |
347 |
throw new IOException("No appropriate API (JAXP/Xerces) to serialize XML document: " + domImpl); |
348 |
} |
335 |
} |
349 |
} |
336 |
} |
350 |
} |
337 |
catch (ClassNotFoundException cnfe) { |
351 |
catch (ClassNotFoundException cnfe) { |