/** * @since 3.3.1 */ @Override public String cachedXPathGetString(String xpath, String prefixMappings) throws Docx4JException { return getData().cachedXPathGetString(xpath, prefixMappings); }
@Override public String xpathGetString(String xpath, String prefixMappings) throws Docx4JException { return getData().xpathGetString(xpath, prefixMappings); }
@Override public List<Node> xpathGetNodes(String xpathString, String prefixMappings) throws Docx4JException { return getData().xpathGetNodes(xpathString, prefixMappings); }
/** * Set the XML * * @since 6.0.0 */ @Override public void setXML(Document xmlDocument) throws Docx4JException { getData().setDocument(xmlDocument); }
@Override public void discardCacheXPathObject() { getData().discardCacheXPathObject(); }
public void saveCustomXmlDataStoragePart(CustomXmlDataStoragePart part) throws Docx4JException { String targetName = part.getPartName().getName().substring(1); String filePath = dir.getPath() + dir.separator + targetName; File file = new File(filePath); file.getParentFile().mkdirs(); try { FileOutputStream fos = new FileOutputStream(file); part.getData().writeDocument( fos ); fos.close(); } catch (Exception e) { throw new Docx4JException("Error marshalling CustomXmlDataStoragePart " + part.getPartName(), e); } }
org.w3c.dom.Document document = ((CustomXmlDataStoragePart)entry).getData().getDocument(); String localName = document.getDocumentElement().getLocalName(); log.debug(localName);
/** * Workaround for the fact that Xalan doesn't let us pass an AtomicInteger into an extension * function. Instead, it converts it into an int, which means the object in our * bookmarkIdCounter parameter isn't updated. * * So here we wrap the AtomicInteger in a class, * * @author jharrop * */ public static class BookmarkCounter { protected AtomicInteger bookmarkId; BookmarkCounter(AtomicInteger bookmarkId) { this.bookmarkId = bookmarkId; } }
protected static void shallowCopyContent(Part source, Part destination) throws Docx4JException { if (source instanceof BinaryPart) { ((BinaryPart)destination).setBinaryData(((BinaryPart)source).getBuffer()); } else if (source instanceof JaxbXmlPart) { ((JaxbXmlPart)destination).setJaxbElement(((JaxbXmlPart)source).getJaxbElement()); ((JaxbXmlPart)destination).setJAXBContext(((JaxbXmlPart)source).getJAXBContext()); } else if (source instanceof CustomXmlDataStoragePart) { ((CustomXmlDataStoragePart)destination).setData(((CustomXmlDataStoragePart)source).getData()); } else if (source instanceof XmlPart) { ((XmlPart)destination).setDocument(((XmlPart)source).getDocument()); } else { throw new IllegalArgumentException("Dont know how to handle a part of type " + source.getClass().getName()); } } }
public void saveCustomXmlDataStoragePart(CustomXmlDataStoragePart part) throws Docx4JException { String targetName = part.getPartName().getName().substring(1); try { // Add ZIP entry to output stream. zos.putArchiveEntry(new ZipArchiveEntry(targetName)); part.getData().writeDocument( zos ); // Complete the entry zos.closeArchiveEntry(); } catch (Exception e) { throw new Docx4JException("Error marshalling CustomXmlDataStoragePart " + part.getPartName(), e); } }
((org.docx4j.openpackaging.parts.CustomXmlDataStoragePart)part).getData().writeDocument( out );
CustomXmlPart data = CustomXmlDataStoragePartSelector.getCustomXmlDataStoragePart(srcPackage); if (data instanceof CustomXmlDataStoragePart) { Document doc = ((CustomXmlDataStoragePart)data).getData().getDocument(); answerDomDocs.put(getQName(doc.getDocumentElement()), data); } else {
String xpResult = part.getData().xpathGetString(xpath, prefixMappings); log.debug(xpath + " yielded result length" + xpResult.length());
Document data = cdsp.getData().getDocument();
Document data = cdsp.getData().getDocument();
((org.docx4j.openpackaging.parts.CustomXmlDataStoragePart)part).getData().getDocument().getDocumentElement()); log.debug("PUT SUCCESS: " + partName); } catch (Exception e) {
((CustomXmlDataStoragePart)tmpPart).getData() );
@Override public List<Node> xpathGetNodes(String xpathString, String prefixMappings) throws Docx4JException { return getData().xpathGetNodes(xpathString, prefixMappings); }
public void saveCustomXmlDataStoragePart(CustomXmlDataStoragePart part) throws Docx4JException { String targetName = part.getPartName().getName().substring(1); try { // Add ZIP entry to output stream. zos.putArchiveEntry(new ZipArchiveEntry(targetName)); part.getData().writeDocument( zos ); // Complete the entry zos.closeArchiveEntry(); } catch (Exception e) { throw new Docx4JException("Error marshalling CustomXmlDataStoragePart " + part.getPartName(), e); } }