public class OpenMainDocumentAndTraverse
extends AbstractSample
To see what parts comprise your docx, try the PartsList sample.
There will always be a MainDocumentPart, usually called document.xml.
This sample shows you what objects are in that part.
It also shows a general approach for traversing the JAXB object tree in
the Main Document part. It can also be applied to headers, footers etc.
It is an alternative to XSLT, and doesn't require marshalling/unmarshalling.
If many cases, the method getJAXBNodesViaXPath would be more convenient,
but there are 3 JAXB bugs which detract from that (see Getting Started).
See related classes SingleTraversalUtilVisitorCallback
and CompoundTraversalUtilVisitorCallback
- Author:
- jharrop