diff options
Diffstat (limited to 'xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/DocumentDeserializerImpl.java')
-rw-r--r-- | xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/DocumentDeserializerImpl.java | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/DocumentDeserializerImpl.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/DocumentDeserializerImpl.java index b6440691a220..e118cc690ea0 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/DocumentDeserializerImpl.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/DocumentDeserializerImpl.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -79,7 +79,7 @@ import java.io.FileNotFoundException; * PluginFactoryImpl}.</p> * * <p>The <code>serialize</code> method transforms the DOM - * document from the given <code>Document</code> object by + * document from the given <code>Document</code> object by * means of a supplied Xsl Stylesheet.</p> * * @author Aidan Butler @@ -97,7 +97,7 @@ public final class DocumentDeserializerImpl * to this object. * * @param pf A <code>PluginFactoryImpl</code> object. - * + * * @param cd A <code>ConvertData</code> object to read data for * the conversion process by the <code>deserialize</code> * method. @@ -108,17 +108,17 @@ public final class DocumentDeserializerImpl } - + /* * This method performs the xslt transformation on the supplied <code> * Document</code> and returns a <code>ByteArrayOutputStream</code> object. * * Xslt transformation code * - * @return baos A <code>ByteArrayOutputStream</code> object containing + * @return baos A <code>ByteArrayOutputStream</code> object containing * the result of the Xslt transformation. * @throws TransformerException,TransformerConfigurationException - * , FileNotFoundException,IOException + * , FileNotFoundException,IOException * */ public Document deserialize() throws ConvertException, IOException { @@ -129,10 +129,10 @@ public final class DocumentDeserializerImpl GenericOfficeDocument doc = null; ByteArrayOutputStream baos =null; GenericOfficeDocument sxwDoc = new GenericOfficeDocument("output"); - while (enumerate.hasMoreElements()) { + while (enumerate.hasMoreElements()) { docOut = (DOMDocument) enumerate.nextElement(); } - domDoc = docOut.getContentDOM(); + domDoc = docOut.getContentDOM(); try{ baos = transform(domDoc); sxwDoc.initContentDOM(); @@ -140,7 +140,7 @@ public final class DocumentDeserializerImpl dFactory.setNamespaceAware(true); DocumentBuilder dBuilder = dFactory.newDocumentBuilder(); sxwDoc.setContentDOM(dBuilder.parse(new ByteArrayInputStream(baos.toByteArray()))); - + } catch(Exception e){ System.out.println("The following error occurred:"+e); @@ -166,23 +166,23 @@ public final class DocumentDeserializerImpl return null; } } - else + else return null; } /* - * This method performs the xslt transformation on the supplied Dom Tree. + * This method performs the xslt transformation on the supplied Dom Tree. * * Xslt transformation code * * @throws TransformerException,TransformerConfigurationException - * , FileNotFoundException,IOException + * , FileNotFoundException,IOException * */ - private ByteArrayOutputStream transform(org.w3c.dom.Document xmlDoc) + private ByteArrayOutputStream transform(org.w3c.dom.Document xmlDoc) throws TransformerException,TransformerConfigurationException , FileNotFoundException,IOException{ - + log("\nTransforming..."); ConverterInfo ci = pluginFactory.getConverterInfo(); ByteArrayOutputStream baos= new ByteArrayOutputStream(); @@ -190,7 +190,7 @@ public final class DocumentDeserializerImpl DocumentBuilderFactory dFactory = DocumentBuilderFactory.newInstance(); dFactory.setNamespaceAware(true); DocumentBuilder dBuilder = dFactory.newDocumentBuilder(); - + String teststr = ci.getXsltDeserial(); teststr= teststr.substring(0,6); org.w3c.dom.Document xslDoc=null; @@ -200,21 +200,21 @@ public final class DocumentDeserializerImpl xslDoc= dBuilder.parse(ci.getXsltDeserial()); } - else{ + else{ log(ci.getJarName()+"!/"+ci.getXsltDeserial()); xslDoc = dBuilder.parse( "jar:"+ci.getJarName()+"!/"+ci.getXsltDeserial()); } - + DOMSource xslDomSource = new DOMSource(xslDoc); DOMSource xmlDomSource = new DOMSource(xmlDoc); - + //call the tranformer using the XSL, Source and Result dom. - TransformerFactory tFactory = TransformerFactory.newInstance(); + TransformerFactory tFactory = TransformerFactory.newInstance(); tFactory.setURIResolver(this); Transformer transformer = tFactory.newTransformer(xslDomSource); - transformer.transform(xmlDomSource,new StreamResult(baos)); + transformer.transform(xmlDomSource,new StreamResult(baos)); /* // Serialize for output to standard out Serializer serializer = SerializerFactory.getSerializer @@ -222,9 +222,9 @@ public final class DocumentDeserializerImpl serializer.setOutputStream(System.out); serializer.asDOMSerializer().serialize(xmlDomResult.getNode()); */ - + log("\n** Transform Complete ***"); - + } catch (StackOverflowError sOE){ System.out.println("\nERROR : Stack Overflow Error During Transformation\n Try increasing the stack size by passing the -Xss1m option to the JRE."); |