Java cleanup - remove unnecessary null checks
Change-Id: I72a847b1180e9aeb8dec18bcaedee7286eee7754
This commit is contained in:
committed by
Stephan Bergmann
parent
0439c5189a
commit
4e2c95c786
@@ -253,10 +253,8 @@ public class List extends DescendantManager implements javax.accessibility.Acces
|
|||||||
XAccessibleContext xAccessibleContext = unoAccessible.getAccessibleContext();
|
XAccessibleContext xAccessibleContext = unoAccessible.getAccessibleContext();
|
||||||
if (xAccessibleContext != null) {
|
if (xAccessibleContext != null) {
|
||||||
javax.accessibility.AccessibleContext ac = new AccessibleListItem(xAccessibleContext);
|
javax.accessibility.AccessibleContext ac = new AccessibleListItem(xAccessibleContext);
|
||||||
if (ac != null) {
|
ac.setAccessibleParent(List.this);
|
||||||
ac.setAccessibleParent(List.this);
|
accessibleContext = ac;
|
||||||
accessibleContext = ac;
|
|
||||||
}
|
|
||||||
AccessibleStateAdapter.setComponentState(this, xAccessibleContext.getAccessibleStateSet());
|
AccessibleStateAdapter.setComponentState(this, xAccessibleContext.getAccessibleStateSet());
|
||||||
}
|
}
|
||||||
} catch (com.sun.star.uno.RuntimeException e) {
|
} catch (com.sun.star.uno.RuntimeException e) {
|
||||||
|
@@ -478,11 +478,9 @@ public class Table extends DescendantManager implements javax.accessibility.Acce
|
|||||||
try {
|
try {
|
||||||
XAccessibleContext xAccessibleContext = unoAccessible.getAccessibleContext();
|
XAccessibleContext xAccessibleContext = unoAccessible.getAccessibleContext();
|
||||||
if (xAccessibleContext != null) {
|
if (xAccessibleContext != null) {
|
||||||
javax.accessibility.AccessibleContext ac = new AccessibleTableCell(xAccessibleContext);
|
javax.accessibility.AccessibleContext ac = new AccessibleTableCell(xAccessibleContext);
|
||||||
if (ac != null) {
|
ac.setAccessibleParent(Table.this);
|
||||||
ac.setAccessibleParent(Table.this);
|
accessibleContext = ac;
|
||||||
accessibleContext = ac;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (com.sun.star.uno.RuntimeException e) {
|
} catch (com.sun.star.uno.RuntimeException e) {
|
||||||
}
|
}
|
||||||
|
@@ -490,11 +490,9 @@ public class Tree extends DescendantManager implements javax.accessibility.Acces
|
|||||||
try {
|
try {
|
||||||
XAccessibleContext xAccessibleContext = unoAccessible.getAccessibleContext();
|
XAccessibleContext xAccessibleContext = unoAccessible.getAccessibleContext();
|
||||||
if (xAccessibleContext != null) {
|
if (xAccessibleContext != null) {
|
||||||
javax.accessibility.AccessibleContext ac = new AccessibleTreeItem(xAccessibleContext);
|
javax.accessibility.AccessibleContext ac = new AccessibleTreeItem(xAccessibleContext);
|
||||||
if (ac != null) {
|
ac.setAccessibleParent(Tree.this);
|
||||||
ac.setAccessibleParent(Tree.this);
|
accessibleContext = ac;
|
||||||
accessibleContext = ac;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (com.sun.star.uno.RuntimeException e) {
|
} catch (com.sun.star.uno.RuntimeException e) {
|
||||||
}
|
}
|
||||||
|
@@ -350,12 +350,10 @@ final class InstallationFinder {
|
|||||||
"reading which command output failed: " + e );
|
"reading which command output failed: " + e );
|
||||||
return null;
|
return null;
|
||||||
} finally {
|
} finally {
|
||||||
if ( br != null ) {
|
try {
|
||||||
try {
|
br.close();
|
||||||
br.close();
|
} catch ( IOException e ) {
|
||||||
} catch ( IOException e ) {
|
// closing standard input stream failed, ignore
|
||||||
// closing standard input stream failed, ignore
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -127,9 +127,7 @@ class WseHeader extends Wse {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bs != null) {
|
return bs.toByteArray();
|
||||||
return bs.toByteArray();
|
|
||||||
} else return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -510,106 +510,107 @@ public abstract class OfficeDocument
|
|||||||
throw new OfficeDocumentException(ex);
|
throw new OfficeDocumentException(ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isZip)
|
if (isZip) {
|
||||||
{
|
|
||||||
read(is);
|
read(is);
|
||||||
}
|
} else {
|
||||||
else{
|
try {
|
||||||
try{
|
Reader r = secondHack(is);
|
||||||
Reader r = secondHack(is);
|
InputSource ins = new InputSource(r);
|
||||||
InputSource ins = new InputSource(r);
|
org.w3c.dom.Document newDoc = builder.parse(ins);
|
||||||
org.w3c.dom.Document newDoc = builder.parse(ins);
|
Element rootElement = newDoc.getDocumentElement();
|
||||||
Element rootElement=newDoc.getDocumentElement();
|
|
||||||
|
|
||||||
NodeList nodeList;
|
NodeList nodeList;
|
||||||
Node tmpNode;
|
Node tmpNode;
|
||||||
Node rootNode = rootElement;
|
Node rootNode = rootElement;
|
||||||
if (newDoc !=null){
|
|
||||||
/*content*/
|
|
||||||
contentDoc = createDOM(TAG_OFFICE_DOCUMENT_CONTENT);
|
|
||||||
rootElement=contentDoc.getDocumentElement();
|
|
||||||
rootNode = rootElement;
|
|
||||||
|
|
||||||
// FIX (HJ): Include office:font-decls in content DOM
|
/* content */
|
||||||
nodeList= newDoc.getElementsByTagName(TAG_OFFICE_FONT_DECLS);
|
contentDoc = createDOM(TAG_OFFICE_DOCUMENT_CONTENT);
|
||||||
if (nodeList.getLength()>0){
|
rootElement = contentDoc.getDocumentElement();
|
||||||
tmpNode = contentDoc.importNode(nodeList.item(0),true);
|
rootNode = rootElement;
|
||||||
rootNode.appendChild(tmpNode);
|
|
||||||
}
|
|
||||||
|
|
||||||
nodeList= newDoc.getElementsByTagName(TAG_OFFICE_AUTOMATIC_STYLES);
|
// FIX (HJ): Include office:font-decls in content DOM
|
||||||
if (nodeList.getLength()>0){
|
nodeList = newDoc
|
||||||
tmpNode = contentDoc.importNode(nodeList.item(0),true);
|
.getElementsByTagName(TAG_OFFICE_FONT_DECLS);
|
||||||
rootNode.appendChild(tmpNode);
|
if (nodeList.getLength() > 0) {
|
||||||
}
|
tmpNode = contentDoc.importNode(nodeList.item(0), true);
|
||||||
|
rootNode.appendChild(tmpNode);
|
||||||
nodeList= newDoc.getElementsByTagName(TAG_OFFICE_BODY);
|
|
||||||
if (nodeList.getLength()>0){
|
|
||||||
tmpNode = contentDoc.importNode(nodeList.item(0),true);
|
|
||||||
rootNode.appendChild(tmpNode);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*Styles*/
|
|
||||||
styleDoc = createDOM(TAG_OFFICE_DOCUMENT_STYLES);
|
|
||||||
rootElement=styleDoc.getDocumentElement();
|
|
||||||
rootNode = rootElement;
|
|
||||||
|
|
||||||
// FIX (HJ): Include office:font-decls in styles DOM
|
|
||||||
nodeList= newDoc.getElementsByTagName(TAG_OFFICE_FONT_DECLS);
|
|
||||||
if (nodeList.getLength()>0){
|
|
||||||
tmpNode = styleDoc.importNode(nodeList.item(0),true);
|
|
||||||
rootNode.appendChild(tmpNode);
|
|
||||||
}
|
|
||||||
|
|
||||||
nodeList= newDoc.getElementsByTagName(TAG_OFFICE_STYLES);
|
|
||||||
if (nodeList.getLength()>0){
|
|
||||||
tmpNode = styleDoc.importNode(nodeList.item(0),true);
|
|
||||||
rootNode.appendChild(tmpNode);
|
|
||||||
}
|
|
||||||
|
|
||||||
// FIX (HJ): Include office:automatic-styles in styles DOM
|
|
||||||
nodeList= newDoc.getElementsByTagName(TAG_OFFICE_AUTOMATIC_STYLES);
|
|
||||||
if (nodeList.getLength()>0){
|
|
||||||
tmpNode = styleDoc.importNode(nodeList.item(0),true);
|
|
||||||
rootNode.appendChild(tmpNode);
|
|
||||||
}
|
|
||||||
|
|
||||||
// FIX (HJ): Include office:master-styles in styles DOM
|
|
||||||
nodeList= newDoc.getElementsByTagName(TAG_OFFICE_MASTER_STYLES);
|
|
||||||
if (nodeList.getLength()>0){
|
|
||||||
tmpNode = styleDoc.importNode(nodeList.item(0),true);
|
|
||||||
rootNode.appendChild(tmpNode);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*Settings*/
|
|
||||||
settingsDoc = createDOM(TAG_OFFICE_DOCUMENT_SETTINGS);
|
|
||||||
rootElement=settingsDoc.getDocumentElement();
|
|
||||||
rootNode = rootElement;
|
|
||||||
nodeList= newDoc.getElementsByTagName(TAG_OFFICE_SETTINGS);
|
|
||||||
if (nodeList.getLength()>0){
|
|
||||||
tmpNode = settingsDoc.importNode(nodeList.item(0),true);
|
|
||||||
rootNode.appendChild(tmpNode);
|
|
||||||
}
|
|
||||||
/*Meta*/
|
|
||||||
metaDoc = createDOM(TAG_OFFICE_DOCUMENT_META);
|
|
||||||
rootElement=metaDoc.getDocumentElement();
|
|
||||||
rootNode = rootElement;
|
|
||||||
nodeList= newDoc.getElementsByTagName(TAG_OFFICE_META);
|
|
||||||
if (nodeList.getLength()>0){
|
|
||||||
tmpNode = metaDoc.importNode(nodeList.item(0),true);
|
|
||||||
rootNode.appendChild(tmpNode);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nodeList = newDoc
|
||||||
|
.getElementsByTagName(TAG_OFFICE_AUTOMATIC_STYLES);
|
||||||
|
if (nodeList.getLength() > 0) {
|
||||||
|
tmpNode = contentDoc.importNode(nodeList.item(0), true);
|
||||||
|
rootNode.appendChild(tmpNode);
|
||||||
|
}
|
||||||
|
|
||||||
|
nodeList = newDoc.getElementsByTagName(TAG_OFFICE_BODY);
|
||||||
|
if (nodeList.getLength() > 0) {
|
||||||
|
tmpNode = contentDoc.importNode(nodeList.item(0), true);
|
||||||
|
rootNode.appendChild(tmpNode);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Styles */
|
||||||
|
styleDoc = createDOM(TAG_OFFICE_DOCUMENT_STYLES);
|
||||||
|
rootElement = styleDoc.getDocumentElement();
|
||||||
|
rootNode = rootElement;
|
||||||
|
|
||||||
|
// FIX (HJ): Include office:font-decls in styles DOM
|
||||||
|
nodeList = newDoc
|
||||||
|
.getElementsByTagName(TAG_OFFICE_FONT_DECLS);
|
||||||
|
if (nodeList.getLength() > 0) {
|
||||||
|
tmpNode = styleDoc.importNode(nodeList.item(0), true);
|
||||||
|
rootNode.appendChild(tmpNode);
|
||||||
|
}
|
||||||
|
|
||||||
|
nodeList = newDoc.getElementsByTagName(TAG_OFFICE_STYLES);
|
||||||
|
if (nodeList.getLength() > 0) {
|
||||||
|
tmpNode = styleDoc.importNode(nodeList.item(0), true);
|
||||||
|
rootNode.appendChild(tmpNode);
|
||||||
|
}
|
||||||
|
|
||||||
|
// FIX (HJ): Include office:automatic-styles in styles DOM
|
||||||
|
nodeList = newDoc
|
||||||
|
.getElementsByTagName(TAG_OFFICE_AUTOMATIC_STYLES);
|
||||||
|
if (nodeList.getLength() > 0) {
|
||||||
|
tmpNode = styleDoc.importNode(nodeList.item(0), true);
|
||||||
|
rootNode.appendChild(tmpNode);
|
||||||
|
}
|
||||||
|
|
||||||
|
// FIX (HJ): Include office:master-styles in styles DOM
|
||||||
|
nodeList = newDoc
|
||||||
|
.getElementsByTagName(TAG_OFFICE_MASTER_STYLES);
|
||||||
|
if (nodeList.getLength() > 0) {
|
||||||
|
tmpNode = styleDoc.importNode(nodeList.item(0), true);
|
||||||
|
rootNode.appendChild(tmpNode);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Settings */
|
||||||
|
settingsDoc = createDOM(TAG_OFFICE_DOCUMENT_SETTINGS);
|
||||||
|
rootElement = settingsDoc.getDocumentElement();
|
||||||
|
rootNode = rootElement;
|
||||||
|
nodeList = newDoc.getElementsByTagName(TAG_OFFICE_SETTINGS);
|
||||||
|
if (nodeList.getLength() > 0) {
|
||||||
|
tmpNode = settingsDoc
|
||||||
|
.importNode(nodeList.item(0), true);
|
||||||
|
rootNode.appendChild(tmpNode);
|
||||||
|
}
|
||||||
|
/* Meta */
|
||||||
|
metaDoc = createDOM(TAG_OFFICE_DOCUMENT_META);
|
||||||
|
rootElement = metaDoc.getDocumentElement();
|
||||||
|
rootNode = rootElement;
|
||||||
|
nodeList = newDoc.getElementsByTagName(TAG_OFFICE_META);
|
||||||
|
if (nodeList.getLength() > 0) {
|
||||||
|
tmpNode = metaDoc.importNode(nodeList.item(0), true);
|
||||||
|
rootNode.appendChild(tmpNode);
|
||||||
|
}
|
||||||
|
} catch (SAXException ex) {
|
||||||
|
throw new OfficeDocumentException(ex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (SAXException ex) {
|
|
||||||
throw new OfficeDocumentException(ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse given <code>byte</code> array into a DOM
|
* Parse given <code>byte</code> array into a DOM
|
||||||
* <code>Document</code> object using the
|
* <code>Document</code> object using the
|
||||||
|
@@ -100,89 +100,113 @@ public final class DocumentSerializerImpl
|
|||||||
* @throws IOException If any I/O error occurs.
|
* @throws IOException If any I/O error occurs.
|
||||||
*/
|
*/
|
||||||
public ConvertData serialize() throws ConvertException, IOException {
|
public ConvertData serialize() throws ConvertException, IOException {
|
||||||
String docName = sxwDoc.getName();
|
String docName = sxwDoc.getName();
|
||||||
org.w3c.dom.Document domDoc = sxwDoc.getContentDOM();
|
org.w3c.dom.Document domDoc = sxwDoc.getContentDOM();
|
||||||
org.w3c.dom.Document metaDoc = sxwDoc.getMetaDOM();
|
org.w3c.dom.Document metaDoc = sxwDoc.getMetaDOM();
|
||||||
org.w3c.dom.Document styleDoc = sxwDoc.getStyleDOM();
|
org.w3c.dom.Document styleDoc = sxwDoc.getStyleDOM();
|
||||||
ByteArrayOutputStream baos= new ByteArrayOutputStream();
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||||
ConvertData cd = new ConvertData();
|
ConvertData cd = new ConvertData();
|
||||||
Node offnode = domDoc.getDocumentElement();
|
Node offnode = domDoc.getDocumentElement();
|
||||||
if (!(offnode.getNodeName()).equals("office:document")){
|
if (!(offnode.getNodeName()).equals("office:document")) {
|
||||||
try{
|
try {
|
||||||
DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
|
DocumentBuilderFactory builderFactory = DocumentBuilderFactory
|
||||||
DocumentBuilder builder= builderFactory.newDocumentBuilder();
|
.newInstance();
|
||||||
DOMImplementation domImpl = builder.getDOMImplementation();
|
DocumentBuilder builder = builderFactory.newDocumentBuilder();
|
||||||
DocumentType docType =domImpl.createDocumentType("office:document","-//OpenOffice.org//DTD OfficeDocument 1.0//EN",null);
|
DOMImplementation domImpl = builder.getDOMImplementation();
|
||||||
org.w3c.dom.Document newDoc = domImpl.createDocument("http://openoffice.org/2000/office","office:document",docType);
|
DocumentType docType = domImpl.createDocumentType(
|
||||||
|
"office:document",
|
||||||
|
"-//OpenOffice.org//DTD OfficeDocument 1.0//EN", null);
|
||||||
|
org.w3c.dom.Document newDoc = domImpl.createDocument(
|
||||||
|
"http://openoffice.org/2000/office", "office:document",
|
||||||
|
docType);
|
||||||
|
|
||||||
|
Element rootElement = newDoc.getDocumentElement();
|
||||||
|
rootElement.setAttribute("xmlns:office",
|
||||||
|
"http://openoffice.org/2000/office");
|
||||||
|
rootElement.setAttribute("xmlns:style",
|
||||||
|
"http://openoffice.org/2000/style");
|
||||||
|
rootElement.setAttribute("xmlns:text",
|
||||||
|
"http://openoffice.org/2000/text");
|
||||||
|
rootElement.setAttribute("xmlns:table",
|
||||||
|
"http://openoffice.org/2000/table");
|
||||||
|
|
||||||
Element rootElement=newDoc.getDocumentElement();
|
rootElement.setAttribute("xmlns:draw",
|
||||||
rootElement.setAttribute("xmlns:office","http://openoffice.org/2000/office");
|
"http://openoffice.org/2000/drawing");
|
||||||
rootElement.setAttribute("xmlns:style","http://openoffice.org/2000/style" );
|
rootElement.setAttribute("xmlns:fo",
|
||||||
rootElement.setAttribute("xmlns:text","http://openoffice.org/2000/text");
|
"http://www.w3.org/1999/XSL/Format");
|
||||||
rootElement.setAttribute("xmlns:table","http://openoffice.org/2000/table");
|
rootElement.setAttribute("xmlns:xlink",
|
||||||
|
"http://www.w3.org/1999/xlink");
|
||||||
|
rootElement.setAttribute("xmlns:dc",
|
||||||
|
"http://purl.org/dc/elements/1.1/");
|
||||||
|
rootElement.setAttribute("xmlns:meta",
|
||||||
|
"http://openoffice.org/2000/meta");
|
||||||
|
rootElement.setAttribute("xmlns:number",
|
||||||
|
"http://openoffice.org/2000/datastyle");
|
||||||
|
rootElement.setAttribute("xmlns:svg",
|
||||||
|
"http://www.w3.org/2000/svg");
|
||||||
|
rootElement.setAttribute("xmlns:chart",
|
||||||
|
"http://openoffice.org/2000/chart");
|
||||||
|
rootElement.setAttribute("xmlns:dr3d",
|
||||||
|
"http://openoffice.org/2000/dr3d");
|
||||||
|
rootElement.setAttribute("xmlns:math",
|
||||||
|
"http://www.w3.org/1998/Math/MathML");
|
||||||
|
rootElement.setAttribute("xmlns:form",
|
||||||
|
"http://openoffice.org/2000/form");
|
||||||
|
rootElement.setAttribute("xmlns:script",
|
||||||
|
"http://openoffice.org/2000/script");
|
||||||
|
rootElement.setAttribute("xmlns:config",
|
||||||
|
"http://openoffice.org/2001/config");
|
||||||
|
rootElement.setAttribute("office:class", "text");
|
||||||
|
rootElement.setAttribute("office:version", "1.0");
|
||||||
|
|
||||||
rootElement.setAttribute("xmlns:draw","http://openoffice.org/2000/drawing");
|
NodeList nodeList;
|
||||||
rootElement.setAttribute("xmlns:fo","http://www.w3.org/1999/XSL/Format" );
|
Node tmpNode;
|
||||||
rootElement.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink" );
|
Node rootNode = rootElement;
|
||||||
rootElement.setAttribute("xmlns:dc","http://purl.org/dc/elements/1.1/" );
|
if (metaDoc != null) {
|
||||||
rootElement.setAttribute("xmlns:meta","http://openoffice.org/2000/meta" );
|
nodeList = metaDoc.getElementsByTagName(TAG_OFFICE_META);
|
||||||
rootElement.setAttribute("xmlns:number","http://openoffice.org/2000/datastyle" );
|
if (nodeList.getLength() > 0) {
|
||||||
rootElement.setAttribute("xmlns:svg","http://www.w3.org/2000/svg" );
|
tmpNode = newDoc.importNode(nodeList.item(0), true);
|
||||||
rootElement.setAttribute("xmlns:chart","http://openoffice.org/2000/chart" );
|
rootNode.appendChild(tmpNode);
|
||||||
rootElement.setAttribute("xmlns:dr3d","http://openoffice.org/2000/dr3d" );
|
}
|
||||||
rootElement.setAttribute("xmlns:math","http://www.w3.org/1998/Math/MathML" );
|
}
|
||||||
rootElement.setAttribute("xmlns:form","http://openoffice.org/2000/form" );
|
if (styleDoc != null) {
|
||||||
rootElement.setAttribute("xmlns:script","http://openoffice.org/2000/script" );
|
nodeList = styleDoc.getElementsByTagName(TAG_OFFICE_STYLES);
|
||||||
rootElement.setAttribute("xmlns:config","http://openoffice.org/2001/config" );
|
if (nodeList.getLength() > 0) {
|
||||||
rootElement.setAttribute("office:class","text" );
|
tmpNode = newDoc.importNode(nodeList.item(0), true);
|
||||||
rootElement.setAttribute("office:version","1.0");
|
rootNode.appendChild(tmpNode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
nodeList = domDoc
|
||||||
|
.getElementsByTagName(TAG_OFFICE_AUTOMATIC_STYLES);
|
||||||
|
if (nodeList.getLength() > 0) {
|
||||||
|
tmpNode = newDoc.importNode(nodeList.item(0), true);
|
||||||
|
rootNode.appendChild(tmpNode);
|
||||||
|
}
|
||||||
|
nodeList = domDoc.getElementsByTagName(TAG_OFFICE_BODY);
|
||||||
|
if (nodeList.getLength() > 0) {
|
||||||
|
tmpNode = newDoc.importNode(nodeList.item(0), true);
|
||||||
|
rootNode.appendChild(tmpNode);
|
||||||
|
}
|
||||||
|
domDoc = newDoc;
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out
|
||||||
|
.println("\nAn Exception occurred with Xslt Serializer"
|
||||||
|
+ e);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
NodeList nodeList;
|
|
||||||
Node tmpNode;
|
|
||||||
Node rootNode = rootElement;
|
|
||||||
if (metaDoc !=null){
|
|
||||||
nodeList= metaDoc.getElementsByTagName(TAG_OFFICE_META);
|
|
||||||
if (nodeList.getLength()>0){
|
|
||||||
tmpNode = newDoc.importNode(nodeList.item(0),true);
|
|
||||||
rootNode.appendChild(tmpNode);
|
|
||||||
}
|
|
||||||
} if (styleDoc !=null){
|
|
||||||
nodeList= styleDoc.getElementsByTagName(TAG_OFFICE_STYLES);
|
|
||||||
if (nodeList.getLength()>0){
|
|
||||||
tmpNode = newDoc.importNode(nodeList.item(0),true);
|
|
||||||
rootNode.appendChild(tmpNode);
|
|
||||||
}
|
|
||||||
}if (domDoc !=null){
|
|
||||||
nodeList= domDoc.getElementsByTagName(TAG_OFFICE_AUTOMATIC_STYLES);
|
|
||||||
if (nodeList.getLength()>0){
|
|
||||||
tmpNode = newDoc.importNode(nodeList.item(0),true);
|
|
||||||
rootNode.appendChild(tmpNode);
|
|
||||||
}
|
|
||||||
nodeList= domDoc.getElementsByTagName(TAG_OFFICE_BODY);
|
|
||||||
if (nodeList.getLength()>0){
|
|
||||||
tmpNode = newDoc.importNode(nodeList.item(0),true);
|
|
||||||
rootNode.appendChild(tmpNode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
domDoc=newDoc;
|
|
||||||
}catch(Exception e){
|
|
||||||
System.out.println("\nAn Exception occurred with Xslt Serializer"+e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
try {
|
||||||
|
baos = transform(domDoc);
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println("\n Error with Xslt\n");
|
||||||
|
}
|
||||||
|
|
||||||
try{
|
DOMDocument resultDomDoc = (DOMDocument) pluginFactory
|
||||||
baos=transform(domDoc);
|
.createDeviceDocument(docName,
|
||||||
}
|
new ByteArrayInputStream(baos.toByteArray()));
|
||||||
catch (Exception e){
|
cd.addDocument(resultDomDoc);
|
||||||
System.out.println("\n Error with Xslt\n");
|
return cd;
|
||||||
}
|
|
||||||
|
|
||||||
DOMDocument resultDomDoc=(DOMDocument)pluginFactory.createDeviceDocument(docName,new ByteArrayInputStream(baos.toByteArray()));
|
|
||||||
cd.addDocument (resultDomDoc);
|
|
||||||
return cd;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Source resolve(String href,String base)
|
public Source resolve(String href,String base)
|
||||||
|
Reference in New Issue
Block a user