E - type of the content tree objectpublic abstract class JaxbXmlPart<E> extends Part
| Modifier and Type | Field and Description |
|---|---|
protected E |
jaxbElement
The content tree (ie JAXB representation of the Part)
|
protected JAXBContext |
jc |
protected static org.slf4j.Logger |
log |
protected static long |
MAX_BYTES_Unmarshal_Error |
contentType, partName, relationships| Constructor and Description |
|---|
JaxbXmlPart(PartName partName) |
JaxbXmlPart(PartName partName,
JAXBContext jc) |
| Modifier and Type | Method and Description |
|---|---|
void |
addMcChoiceNamespace(String mcChoiceNamespace)
Specify a namespace prefix (used in mc:Choice/@Requires) which
docx4j should declare on the top-level element of the part
(otherwise Microsoft Office won't be able to open the file).
|
E |
getContents()
Get the live contents of this part (the JAXB object model).
|
JAXBContext |
getJAXBContext() |
E |
getJaxbElement()
Get the live contents of this part.
|
String |
getMcChoiceNamespaces() |
String |
getMceIgnorable() |
String |
getXML()
See your content as XML.
|
boolean |
isContentEqual(Part other) |
boolean |
isUnmarshalled() |
void |
marshal(Node node)
Marshal the content tree rooted at jaxbElement into a DOM tree.
|
void |
marshal(Node node,
Object namespacePrefixMapper)
Marshal the content tree rooted at jaxbElement into a DOM tree.
|
void |
marshal(OutputStream os)
Marshal the content tree rooted at jaxbElement into an output
stream, using org.docx4j.jaxb.NamespacePrefixMapper.
|
void |
marshal(OutputStream os,
Object namespacePrefixMapper)
Marshal the content tree rooted at jaxbElement into an output
stream
|
void |
pipe(SAXHandler saxHandler)
Replace the contents of this part with the output of passing it through your SAXHandler.
|
void |
pipe(StAXHandlerInterface handler)
Replace the contents of this part with the output of passing it through your StAXHandler.
|
void |
pipe(StAXHandlerInterface handler,
StreamFilter filter)
Replace the contents of this part with the output of passing it through your StAXHandler.
|
void |
setContents(E jaxbElement)
Set the contents of this part.
|
void |
setJAXBContext(JAXBContext jc) |
void |
setJaxbElement(E jaxbElement) |
void |
setJaxbElement(JAXBResult result) |
protected void |
setMceIgnorable(McIgnorableNamespaceDeclarator namespacePrefixMapper)
Where the mc:Ignorable attribute is present,
ensure its contents matches the ignorable namespaces
actually present.
|
void |
transform(Templates xslt,
Map<String,Object> transformParameters,
Result result)
Use an XSLT to alter the contents of this part.
|
E |
unmarshal(Element el) |
E |
unmarshal(InputStream is)
Unmarshal XML data from the specified InputStream and return the
resulting content tree.
|
void |
variableReplace(Map<String,String> mappings)
unmarshallFromTemplate.
|
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 JAXBContext jc
protected static long MAX_BYTES_Unmarshal_Error
protected E jaxbElement
public JaxbXmlPart(PartName partName) throws InvalidFormatException
InvalidFormatExceptionpublic JaxbXmlPart(PartName partName, JAXBContext jc) throws InvalidFormatException
InvalidFormatExceptionpublic void setJAXBContext(JAXBContext jc)
public JAXBContext getJAXBContext()
public E getContents() throws Docx4JException
Docx4JExceptionpublic E getJaxbElement()
public void setJaxbElement(E jaxbElement)
public void setContents(E jaxbElement)
jaxbElement - public void setJaxbElement(JAXBResult result) throws JAXBException
JAXBExceptionpublic String getXML()
public boolean isUnmarshalled()
public void variableReplace(Map<String,String> mappings) throws JAXBException, Docx4JException
mappings - JAXBExceptionDocx4JExceptionpublic void transform(Templates xslt, Map<String,Object> transformParameters, Result result) throws Docx4JException
xslt - transformParameters - ExceptionDocx4JExceptionpublic void pipe(SAXHandler saxHandler) throws ParserConfigurationException, SAXException, Docx4JException, IOException, JAXBException
saxHandler - ParserConfigurationExceptionSAXExceptionDocx4JExceptionIOExceptionJAXBExceptionpublic void pipe(StAXHandlerInterface handler) throws XMLStreamException, Docx4JException, JAXBException
handler - XMLStreamExceptionDocx4JExceptionJAXBExceptionpublic void pipe(StAXHandlerInterface handler, StreamFilter filter) throws XMLStreamException, Docx4JException, JAXBException
handler - filter - XMLStreamExceptionDocx4JExceptionJAXBExceptionpublic void marshal(Node node) throws JAXBException
node - DOM nodes will be added as children of this node.
This parameter must be a Node that accepts children
(Document,
DocumentFragment, or
Element)JAXBException - If any unexpected problem occurs during the marshalling.public void marshal(Node node, Object namespacePrefixMapper) throws JAXBException
node - DOM nodes will be added as children of this node.
This parameter must be a Node that accepts children
(Document,
DocumentFragment, or
Element)JAXBException - If any unexpected problem occurs during the marshalling.public void marshal(OutputStream os) throws JAXBException
os - XML will be added to this stream.JAXBException - If any unexpected problem occurs during the marshalling.public void marshal(OutputStream os, Object namespacePrefixMapper) throws JAXBException
os - XML will be added to this stream.namespacePrefixMapper - namespacePrefixMapperJAXBException - If any unexpected problem occurs during the marshalling.public String getMceIgnorable()
protected void setMceIgnorable(McIgnorableNamespaceDeclarator namespacePrefixMapper)
public String getMcChoiceNamespaces()
public void addMcChoiceNamespace(String mcChoiceNamespace)
mcChoiceNamespace - public E unmarshal(InputStream is) throws JAXBException
Implements Unmarshal Global Root Element.
is - the InputStream to unmarshal XML data fromJAXBException - If any unexpected errors occur while unmarshallingpublic E unmarshal(Element el) throws JAXBException
JAXBExceptionpublic boolean isContentEqual(Part other) throws Docx4JException
isContentEqual in class PartDocx4JExceptionCopyright © 2007-2022. All Rights Reserved.