/** You can't use this override to create/update a binder, since this would set the * jaxbElement field to something different to the object being passed in * (as a consequence of the process to create a binder). * * We don't want that, because calling code may then continue to manipulate * the field, without effect.. * * See instead createBinderAndJaxbElement */ @Override public void setJaxbElement(E jaxbElement) { super.setJaxbElement(jaxbElement); binder=null; // any existing binder is invalid }
public void setJaxbElement(JAXBResult result) throws JAXBException { setJaxbElement((E)result.getResult()); }
part.setJaxbElement(result);
part.setJaxbElement(result); part.setJaxbElement(o); } else part.setJaxbElement(o);
part.setJaxbElement(result); part.setJaxbElement(o); } else part.setJaxbElement(o);
protected static void shallowCopyContent(Part source, Part destination) throws Docx4JException { if (source instanceof BinaryPart) { ((BinaryPart)destination).setBinaryData(((BinaryPart)source).getBuffer()); } else if (source instanceof JaxbXmlPart) { ((JaxbXmlPart)destination).setJaxbElement(((JaxbXmlPart)source).getJaxbElement()); ((JaxbXmlPart)destination).setJAXBContext(((JaxbXmlPart)source).getJAXBContext()); } else if (source instanceof CustomXmlDataStoragePart) { ((CustomXmlDataStoragePart)destination).setData(((CustomXmlDataStoragePart)source).getData()); } else if (source instanceof XmlPart) { ((XmlPart)destination).setDocument(((XmlPart)source).getDocument()); } else { throw new IllegalArgumentException("Dont know how to handle a part of type " + source.getClass().getName()); } } }
part.setJaxbElement( unmarshal(((org.w3c.dom.Document)result.getNode()), Docx4jProperties.getProperty("docx4j.model.datastorage.BindingTraverserXSLT.ValidationEventContinue",
/** * Convert any w:fldSimple in this part to complex field. * @param part * @throws Docx4JException */ public static void complexifyFields(JaxbXmlPart part) throws Docx4JException { org.w3c.dom.Document doc = XmlUtils.marshaltoW3CDomDocument( part.getJaxbElement() ); // XPathsPart xPathsPart = null; JAXBContext jc = Context.jc; try { // Use constructor which takes Unmarshaller, rather than JAXBContext, // so we can set JaxbValidationEventHandler Unmarshaller u = jc.createUnmarshaller(); u.setEventHandler(new org.docx4j.jaxb.JaxbValidationEventHandler()); javax.xml.bind.util.JAXBResult result = new javax.xml.bind.util.JAXBResult(u ); org.docx4j.XmlUtils.transform(doc, xslt, null, result); part.setJaxbElement(result); } catch (Exception e) { throw new Docx4JException("Problems transforming fields", e); } }
((JaxbXmlPart)destination).setJaxbElement(XmlUtils.deepCopy(((JaxbXmlPart)source).getJaxbElement(), ((JaxbXmlPart)source).getJAXBContext())); ((JaxbXmlPart)destination).setJAXBContext(((JaxbXmlPart)source).getJAXBContext());
part.setJaxbElement( traverser.traverseToBind(part, wordMLPackage, xpathsMap) );
if (part instanceof HeaderPart) { clonedPart = new HeaderPart(); clonedPart.setJaxbElement(Context.getWmlObjectFactory().createHdr()); } else if (part instanceof FooterPart) { clonedPart = new FooterPart(); clonedPart.setJaxbElement(Context.getWmlObjectFactory().createFtr());
((JaxbXmlPart)targetPart).setJaxbElement( ((JaxbXmlPart)tmpPart).getJaxbElement() );
/** You can't use this override to create/update a binder, since this would set the * jaxbElement field to something different to the object being passed in * (as a consequence of the process to create a binder). * * We don't want that, because calling code may then continue to manipulate * the field, without effect.. * * See instead createBinderAndJaxbElement */ @Override public void setJaxbElement(E jaxbElement) { super.setJaxbElement(jaxbElement); binder=null; // any existing binder is invalid }
public void setJaxbElement(JAXBResult result) throws JAXBException { setJaxbElement((E)result.getResult()); }
part.setJaxbElement(result); part.setJaxbElement(o); } else part.setJaxbElement(o);
part.setJaxbElement(result); part.setJaxbElement(o); } else part.setJaxbElement(o);
part.setJaxbElement(result);
protected static void shallowCopyContent(Part source, Part destination) throws Docx4JException { if (source instanceof BinaryPart) { ((BinaryPart)destination).setBinaryData(((BinaryPart)source).getBuffer()); } else if (source instanceof JaxbXmlPart) { ((JaxbXmlPart)destination).setJaxbElement(((JaxbXmlPart)source).getJaxbElement()); ((JaxbXmlPart)destination).setJAXBContext(((JaxbXmlPart)source).getJAXBContext()); } else if (source instanceof CustomXmlDataStoragePart) { ((CustomXmlDataStoragePart)destination).setData(((CustomXmlDataStoragePart)source).getData()); } else if (source instanceof XmlPart) { ((XmlPart)destination).setDocument(((XmlPart)source).getDocument()); } else { throw new IllegalArgumentException("Dont know how to handle a part of type " + source.getClass().getName()); } } }
/** * Convert any w:fldSimple in this part to complex field. * @param part * @throws Docx4JException */ public static void complexifyFields(JaxbXmlPart part) throws Docx4JException { org.w3c.dom.Document doc = XmlUtils.marshaltoW3CDomDocument( part.getJaxbElement() ); // XPathsPart xPathsPart = null; JAXBContext jc = Context.jc; try { // Use constructor which takes Unmarshaller, rather than JAXBContext, // so we can set JaxbValidationEventHandler Unmarshaller u = jc.createUnmarshaller(); u.setEventHandler(new org.docx4j.jaxb.JaxbValidationEventHandler()); javax.xml.bind.util.JAXBResult result = new javax.xml.bind.util.JAXBResult(u ); org.docx4j.XmlUtils.transform(doc, xslt, null, result); part.setJaxbElement(result); } catch (Exception e) { throw new Docx4JException("Problems transforming fields", e); } }
((JaxbXmlPart)destination).setJaxbElement(XmlUtils.deepCopy(((JaxbXmlPart)source).getJaxbElement(), ((JaxbXmlPart)source).getJAXBContext())); ((JaxbXmlPart)destination).setJAXBContext(((JaxbXmlPart)source).getJAXBContext());