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 javax.xml.bind.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,
javax.xml.bind.JAXBContext jc) |
| Modifier and Type | Method and Description |
|---|---|
void |
addMcChoiceNamespace(java.lang.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).
|
protected javax.xml.bind.Unmarshaller |
getConfiguredUnmarshaller(boolean eventHandlerContinue)
An Unmarshaller configured with our event handler and listener.
|
E |
getContents()
Get the live contents of this part (the JAXB object model).
|
javax.xml.bind.JAXBContext |
getJAXBContext() |
E |
getJaxbElement()
Get the live contents of this part.
|
java.lang.String |
getMcChoiceNamespaces() |
java.lang.String |
getMceIgnorable() |
java.lang.String |
getXML()
See your content as XML.
|
protected javax.xml.stream.XMLStreamReader |
inputStreamToXSR(java.io.InputStream is) |
boolean |
isContentEqual(Part other) |
boolean |
isUnmarshalled() |
void |
marshal(org.w3c.dom.Node node)
Marshal the content tree rooted at jaxbElement into a DOM tree.
|
void |
marshal(org.w3c.dom.Node node,
java.lang.Object namespacePrefixMapper)
Marshal the content tree rooted at jaxbElement into a DOM tree.
|
void |
marshal(java.io.OutputStream os)
Marshal the content tree rooted at jaxbElement into an output
stream, using org.docx4j.jaxb.NamespacePrefixMapper.
|
void |
marshal(java.io.OutputStream os,
java.lang.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,
javax.xml.stream.StreamFilter filter)
Replace the contents of this part with the output of passing it through your StAXHandler.
|
protected void |
preprocess(java.io.InputStream is,
boolean eventHandlerContinue)
Transform the content through mcPreprocessorXslt
|
void |
setContents(E jaxbElement)
Set the contents of this part.
|
void |
setJAXBContext(javax.xml.bind.JAXBContext jc) |
void |
setJaxbElement(E jaxbElement) |
void |
setJaxbElement(javax.xml.bind.util.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(javax.xml.transform.Templates xslt,
java.util.Map<java.lang.String,java.lang.Object> transformParameters,
javax.xml.transform.Result result)
Use an XSLT to alter the contents of this part.
|
protected org.w3c.dom.Document |
transformToDom(javax.xml.stream.XMLStreamReader xsr)
Prepare input by transforming via mcPreprocessorXslt,
outputting a DOM node, which we can use docx4jUnmarshallerListener on.
|
E |
unmarshal(org.w3c.dom.Element el) |
E |
unmarshal(java.io.InputStream is)
Unmarshal XML data from the specified InputStream and return the
resulting content tree.
|
void |
variableReplace(java.util.Map<java.lang.String,java.lang.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 javax.xml.bind.JAXBContext jc
protected static long MAX_BYTES_Unmarshal_Error
protected E jaxbElement
public JaxbXmlPart(PartName partName) throws InvalidFormatException
InvalidFormatExceptionpublic JaxbXmlPart(PartName partName, javax.xml.bind.JAXBContext jc) throws InvalidFormatException
InvalidFormatExceptionpublic void setJAXBContext(javax.xml.bind.JAXBContext jc)
public javax.xml.bind.JAXBContext getJAXBContext()
public E getContents() throws Docx4JException
Docx4JExceptionpublic E getJaxbElement()
public void setJaxbElement(E jaxbElement)
public void setContents(E jaxbElement)
jaxbElement - public void setJaxbElement(javax.xml.bind.util.JAXBResult result)
throws javax.xml.bind.JAXBException
javax.xml.bind.JAXBExceptionpublic java.lang.String getXML()
public boolean isUnmarshalled()
public void variableReplace(java.util.Map<java.lang.String,java.lang.String> mappings)
throws javax.xml.bind.JAXBException,
Docx4JException
mappings - javax.xml.bind.JAXBExceptionDocx4JExceptionpublic void transform(javax.xml.transform.Templates xslt,
java.util.Map<java.lang.String,java.lang.Object> transformParameters,
javax.xml.transform.Result result)
throws Docx4JException
xslt - transformParameters - java.lang.ExceptionDocx4JExceptionpublic void pipe(SAXHandler saxHandler) throws javax.xml.parsers.ParserConfigurationException, org.xml.sax.SAXException, Docx4JException, java.io.IOException, javax.xml.bind.JAXBException
saxHandler - javax.xml.parsers.ParserConfigurationExceptionorg.xml.sax.SAXExceptionDocx4JExceptionjava.io.IOExceptionjavax.xml.bind.JAXBExceptionpublic void pipe(StAXHandlerInterface handler) throws javax.xml.stream.XMLStreamException, Docx4JException, javax.xml.bind.JAXBException
handler - javax.xml.stream.XMLStreamExceptionDocx4JExceptionjavax.xml.bind.JAXBExceptionpublic void pipe(StAXHandlerInterface handler, javax.xml.stream.StreamFilter filter) throws javax.xml.stream.XMLStreamException, Docx4JException, javax.xml.bind.JAXBException
handler - filter - javax.xml.stream.XMLStreamExceptionDocx4JExceptionjavax.xml.bind.JAXBExceptionpublic void marshal(org.w3c.dom.Node node)
throws javax.xml.bind.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)javax.xml.bind.JAXBException - If any unexpected problem occurs during the marshalling.public void marshal(org.w3c.dom.Node node,
java.lang.Object namespacePrefixMapper)
throws javax.xml.bind.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)javax.xml.bind.JAXBException - If any unexpected problem occurs during the marshalling.public void marshal(java.io.OutputStream os)
throws javax.xml.bind.JAXBException
os - XML will be added to this stream.javax.xml.bind.JAXBException - If any unexpected problem occurs during the marshalling.public void marshal(java.io.OutputStream os,
java.lang.Object namespacePrefixMapper)
throws javax.xml.bind.JAXBException
os - XML will be added to this stream.namespacePrefixMapper - namespacePrefixMapperjavax.xml.bind.JAXBException - If any unexpected problem occurs during the marshalling.public java.lang.String getMceIgnorable()
protected void setMceIgnorable(McIgnorableNamespaceDeclarator namespacePrefixMapper)
public java.lang.String getMcChoiceNamespaces()
public void addMcChoiceNamespace(java.lang.String mcChoiceNamespace)
mcChoiceNamespace - protected javax.xml.bind.Unmarshaller getConfiguredUnmarshaller(boolean eventHandlerContinue)
throws javax.xml.bind.JAXBException
eventHandlerContinue - javax.xml.bind.JAXBExceptionpublic E unmarshal(java.io.InputStream is) throws javax.xml.bind.JAXBException
Implements Unmarshal Global Root Element.
is - the InputStream to unmarshal XML data fromjavax.xml.bind.JAXBException - If any unexpected errors occur while unmarshallingprotected void preprocess(java.io.InputStream is,
boolean eventHandlerContinue)
throws javax.xml.bind.JAXBException
is - eventHandlerContinue - javax.xml.bind.JAXBExceptionprotected org.w3c.dom.Document transformToDom(javax.xml.stream.XMLStreamReader xsr)
throws javax.xml.stream.FactoryConfigurationError,
javax.xml.bind.JAXBException
xsr - javax.xml.stream.FactoryConfigurationErrorjavax.xml.bind.JAXBExceptionprotected javax.xml.stream.XMLStreamReader inputStreamToXSR(java.io.InputStream is)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionpublic E unmarshal(org.w3c.dom.Element el) throws javax.xml.bind.JAXBException
javax.xml.bind.JAXBExceptionpublic boolean isContentEqual(Part other) throws Docx4JException
isContentEqual in class PartDocx4JExceptionCopyright © 2007–2023. All rights reserved.