Main document part, header, footer, footnote, and endnote part all work on the same principles.
They all inherit from JaxbXmlPart, which contains:
Using java Syntax Highlighting
/**
* Unmarshal XML data from the specified InputStream and return the
* resulting content tree. Validation event location information may be
* incomplete when using this form of the unmarshal API.
*
* <p>
* Implements <a href="#unmarshalGlobal">Unmarshal Global Root Element</a>.
*
* @param is
* the InputStream to unmarshal XML data from
* @return the newly created root object of the java content tree
*
* @throws JAXBException
* If any unexpected errors occur while unmarshalling
*/
public E unmarshal
( java.
io.
InputStream is
) throws JAXBException
Parsed in 0.014 seconds, using
GeSHi 1.0.8.4
There is also unmarshal(org.w3c.dom.Element el)
As far as creating the template is concerned, do it in Word. You can work away in the document body if you like (as opposed to in a header or footer), since you'll be creating the same XML (eg w:p elements). Then, yes, extract the XML. One way to do this is documentpart.getXML()