org.docx4j.openpackaging.parts.CustomXmlPart Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of docx4j Show documentation
Show all versions of docx4j Show documentation
docx4j is a library which helps you to work with the Office Open
XML file format as used in docx
documents, pptx presentations, and xlsx spreadsheets.
package org.docx4j.openpackaging.parts;
import java.util.List;
import org.docx4j.openpackaging.exceptions.Docx4JException;
import org.w3c.dom.Node;
/**
* There are two types of these:
* - JaxbCustomXmlDataStoragePart
* - CustomXmlDataStoragePart
*
* This interface doesn't provide getData,
* because the 2 types are quite different.
*
* But it could allow storeItemId to be
* get or set.
*
* @author jharrop
*
*/
public interface CustomXmlPart {
public String xpathGetString(String xpath, String prefixMappings) throws Docx4JException;
/**
* Use org.apache.xpath.CachedXPathAPI, since this is much quicker than default javax.xml.xpath.XPath implementations
* (Apache's anyway) for large XML files.
* This is because Apache's old XPathAPI classinstantiated a new XPathContext
* (and thus building a new DTMManager, and new DTMs) each time it was called.
* XPathAPIObject instead retains its context as long as the object persists,
* reusing the DTMs.
*
* There was the question of whether to implement it here or just in CustomXmlDataStoragePart
* (since this is mostly of value in binding the user's XML data file). It is here since otherwise
* BindingHandler would fail on DocPropsCoverPagePart and StandardisedAnswersPart (both of which
* extend JaxbCustomXmlDataStoragePart).
*
* @see discardCacheXPathObject
*
* @param xpath
* @param prefixMappings
* @return
* @throws Docx4JException
* @since 3.3.1
*/
public String cachedXPathGetString(String xpath, String prefixMappings) throws Docx4JException;
/**
* Use this to null out the org.apache.xpath.CachedXPathAPI object, which you should do
* if you've changed your source document, or want to reclaim memory.
* @since 3.3.1
*/
public void discardCacheXPathObject();
public List xpathGetNodes(String xpathString, String prefixMappings) throws Docx4JException;
/**
* @param xpath
* @param prefixMappings
* @param value
* @throws Docx4JException
* @since 3.0.1
*/
public boolean setNodeValueAtXPath(String xpath, String value, String prefixMappings) throws Docx4JException;
/**
* Get the XML as a String.
* @throws Docx4JException
*
* @since 3.0.1
*/
public String getXML() throws Docx4JException;
/**
* @since 3.0.2
*/
public String getItemId();
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy