Here is my code that works for manipulating other portions of document.xml for a docx file, but I am having trouble changing a setting that is part of the settings.xml part. I am basically performing a string replacement that if successful will turn on track changes for the docx.
private static void xmlSettings(WordprocessingMLPackage wordMLPackage) throws JAXBException
{
DocumentSettingsPart part = wordMLPackage.getMainDocumentPart().getDocumentSettingsPart();
String xml = XmlUtils.marshaltoString(part.getJaxbElement(), true);
xml = xml.replaceAll("<w:defaultTabStop w:val=\"720\" />", "<w:trackRevisions /><w:defaultTabStop w:val=\"720\" />");//Turns track revisions on
Object obj = XmlUtils.unmarshalString(xml);
part.setJaxbElement((Document) obj);
//ERROR = The method setJaxbElement(CTSettings) in the type JaxbXmlPartXPathAware<CTSettings> is not applicable for the arguments (Document)
}
Can anyone see what I am not seeing?