origDoc.write(bos);
SxwDocument origSxwDoc = new SxwDocument("old");
origSxwDoc.read(new ByteArrayInputStream(bos.toByteArray()));
org.w3c.dom.Document origDomDoc = origSxwDoc.getContentDOM();
XmlUtil xu = new XmlUtil();
org.w3c.dom.DocumentFragment df;
org.w3c.dom.Node newNode;
// copy font declarations from original document to the new document
nl = origDomDoc.getElementsByTagName(TAG_OFFICE_FONT_DECLS);
df = doc.createDocumentFragment();
newNode = xu.deepClone(df, nl.item(0));
rootNode.insertBefore(newNode, bodyNode);
// copy style catalog from original document to the new document
nl = origDomDoc.getElementsByTagName(TAG_OFFICE_STYLES);
df = doc.createDocumentFragment();
newNode = xu.deepClone(df, nl.item(0));
rootNode.insertBefore(newNode, bodyNode);
nl = origDomDoc.getElementsByTagName(TAG_OFFICE_AUTOMATIC_STYLES);
df = doc.createDocumentFragment();
newNode = xu.deepClone(df, nl.item(0));
rootNode.insertBefore(newNode, bodyNode);
nl = origDomDoc.getElementsByTagName(TAG_OFFICE_MASTER_STYLES);
df = doc.createDocumentFragment();
newNode = xu.deepClone(df, nl.item(0));
rootNode.insertBefore(newNode, bodyNode);
}
// Original document not specified. We need to add font declarations.
// DJP: this might just be for debugging. Merger will probably put