public abstract class XmlPart extends Part
| Modifier and Type | Field and Description |
|---|---|
protected org.w3c.dom.Document |
doc
This part's XML contents.
|
protected static org.slf4j.Logger |
log |
contentType, partName, relationships| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
cachedXPathGetString(java.lang.String xpath,
java.lang.String prefixMappings)
(Unless you are using Saxon as your XPath implementation (XPathFactoryUtil.setxPathFactory))
this uses org.apache.xpath.CachedXPathAPI for better performance, since Apache's old XPathAPI class,
have the drawback of instantiating a new XPathContext
(and thus building a new DTMManager, and new DTMs) each time it was called.
|
void |
discardCacheXPathObject() |
abstract org.w3c.dom.Document |
getDocument() |
java.lang.String |
getXML()
Get the XML as a String.
|
boolean |
isContentEqual(Part other) |
void |
setDocument(org.w3c.dom.Document doc) |
void |
setDocument(java.io.InputStream is) |
boolean |
setNodeValueAtXPath(java.lang.String xpath,
java.lang.String value,
java.lang.String prefixMappings)
Set the value of the node referenced in the xpath expression.
|
java.util.List<org.w3c.dom.Node> |
xpathGetNodes(java.lang.String xpathString,
java.lang.String prefixMappings) |
java.lang.String |
xpathGetString(java.lang.String xpathString,
java.lang.String prefixMappings)
Note: If the result is an empty node-set, it will be converted to an
empty string, rather than null.
|
getContentLengthAsLoaded, getOwningRelationshipPart, getPackage, getRelationshipType, getSourceRelationship, getSourceRelationships, getVersion, remove, rename, setContentLengthAsLoaded, setOwningRelationshipPart, setPackage, setPartShortcut, setRelationshipType, setSourceRelationship, setVersionaddTargetPart, addTargetPart, addTargetPart, addTargetPart, getContentType, getPartName, getRelationshipsPart, getRelationshipsPart, getUserData, reset, setContentType, setPartName, setRelationships, setUserDataprotected static org.slf4j.Logger log
protected org.w3c.dom.Document doc
public XmlPart(PartName partName) throws InvalidFormatException
InvalidFormatExceptionpublic XmlPart()
throws InvalidFormatException
InvalidFormatExceptionpublic void setDocument(java.io.InputStream is)
throws Docx4JException
Docx4JExceptionpublic void setDocument(org.w3c.dom.Document doc)
public abstract org.w3c.dom.Document getDocument()
throws Docx4JException
Docx4JExceptionpublic java.lang.String getXML()
throws Docx4JException
Docx4JExceptionpublic java.lang.String xpathGetString(java.lang.String xpathString,
java.lang.String prefixMappings)
throws Docx4JException
xpathString - prefixMappings - Docx4JExceptionpublic java.lang.String cachedXPathGetString(java.lang.String xpath,
java.lang.String prefixMappings)
throws Docx4JException
xpath - prefixMappings - Docx4JExceptiondiscardCacheXPathObjectpublic void discardCacheXPathObject()
public java.util.List<org.w3c.dom.Node> xpathGetNodes(java.lang.String xpathString,
java.lang.String prefixMappings)
public boolean setNodeValueAtXPath(java.lang.String xpath,
java.lang.String value,
java.lang.String prefixMappings)
throws Docx4JException
xpath - value - prefixMappings - a string such as "xmlns:ns0='http://schemas.medchart'"Docx4JExceptionpublic boolean isContentEqual(Part other) throws Docx4JException
isContentEqual in class PartDocx4JExceptionCopyright © 2007–2023. All rights reserved.