org.w3c.dom.Document doc = org.docx4j.XmlUtils.neww3cDomDocument();
org.w3c.dom.Document doc = org.docx4j.XmlUtils.neww3cDomDocument();
/** This method is called from the converters with XSL-Transformations * * @param node * @param childResults the already transformed node (element) content * @param doc * @return */ public Node toNode(AbstractWmlConversionContext context, Node node, NodeList childResults) { Object unmarshalledNode = null; Document doc = XmlUtils.neww3cDomDocument(); /* A result tree fragment represents a fragment of the result tree. A result tree fragment is treated equivalently to a node-set that contains just a single root node. */ Node content = ((childResults != null) && (childResults.getLength() > 0) ? childResults.item(0) : null); Node ret = null; try { unmarshalledNode = XmlUtils.unmarshal(node); } catch (JAXBException e) { log.error("Cannot unmarshall " + node.getNodeName(), e); } if (unmarshalledNode != null) { ret = toNode(context, unmarshalledNode, node.getNodeName(), content, doc); } return ret; }
/** * Return the WordML package in Flat OPC format, as a W3C DOM document * * @return * @throws Exception */ public static Document getFlatDomDocument(WordprocessingMLPackage wordMLPackage) throws Docx4JException { FlatOpcXmlCreator worker = new FlatOpcXmlCreator(wordMLPackage); org.docx4j.xmlPackage.Package pkg = worker.get(); org.w3c.dom.Document doc; try { JAXBContext jc = Context.jcXmlPackage; Marshaller marshaller=jc.createMarshaller(); doc = org.docx4j.XmlUtils.neww3cDomDocument(); marshaller.marshal(pkg, doc); } catch (JAXBException e) { throw new Docx4JException("Couldn't marshal Flat OPC to DOM", e); } return doc; }
HTMLConversionContext conversionContext = new HTMLConversionContext(htmlSettings, null, null); Document document = XmlUtils.neww3cDomDocument(); Element parentNode = document.createElement("div"); AbstractVisitorExporterGenerator<HTMLConversionContext> generator = null;
org.w3c.dom.Document docContainer = XmlUtils.neww3cDomDocument(); DocumentFragment docfrag = docContainer.createDocumentFragment();
run.getContent().add(text); org.w3c.dom.Document docContainer = XmlUtils.neww3cDomDocument(); if (sdtParent.equals("p")) {
org.w3c.dom.Document doc = XmlUtils.neww3cDomDocument(); this.marshal(doc); unmarshal( doc.getDocumentElement() );
Document data = XmlUtils.neww3cDomDocument(); try { ((JaxbCustomXmlDataStoragePart)cxp).marshal(data);
org.w3c.dom.Document docContainer = XmlUtils.neww3cDomDocument();
Document data = XmlUtils.neww3cDomDocument(); try { ((JaxbCustomXmlDataStoragePart)cxp).marshal(data);
run.getContent().add(text); org.w3c.dom.Document docContainer = XmlUtils.neww3cDomDocument(); if (sdtParent.equals("p")) {
org.w3c.dom.Document doc = org.docx4j.XmlUtils.neww3cDomDocument(); try { this.marshal(doc);
org.w3c.dom.Document docContainer = XmlUtils.neww3cDomDocument(); DocumentFragment docfrag = docContainer.createDocumentFragment();
document = XmlUtils.neww3cDomDocument();
org.w3c.dom.Document doc = org.docx4j.XmlUtils.neww3cDomDocument(); marshaller.marshal(pkg, doc);
org.w3c.dom.Document doc = org.docx4j.XmlUtils.neww3cDomDocument();
/** This method is called from the converters with XSL-Transformations * * @param node * @param childResults the already transformed node (element) content * @param doc * @return */ public Node toNode(AbstractWmlConversionContext context, Node node, NodeList childResults) { Object unmarshalledNode = null; Document doc = XmlUtils.neww3cDomDocument(); /* A result tree fragment represents a fragment of the result tree. A result tree fragment is treated equivalently to a node-set that contains just a single root node. */ Node content = ((childResults != null) && (childResults.getLength() > 0) ? childResults.item(0) : null); Node ret = null; try { unmarshalledNode = XmlUtils.unmarshal(node); } catch (JAXBException e) { log.error("Cannot unmarshall " + node.getNodeName(), e); } if (unmarshalledNode != null) { ret = toNode(context, unmarshalledNode, node.getNodeName(), content, doc); } return ret; }
/** * Return the WordML package in Flat OPC format, as a W3C DOM document * * @return * @throws Exception */ public static Document getFlatDomDocument(WordprocessingMLPackage wordMLPackage) throws Docx4JException { FlatOpcXmlCreator worker = new FlatOpcXmlCreator(wordMLPackage); org.docx4j.xmlPackage.Package pkg = worker.get(); org.w3c.dom.Document doc; try { JAXBContext jc = Context.jcXmlPackage; Marshaller marshaller=jc.createMarshaller(); doc = org.docx4j.XmlUtils.neww3cDomDocument(); marshaller.marshal(pkg, doc); } catch (JAXBException e) { throw new Docx4JException("Couldn't marshal Flat OPC to DOM", e); } return doc; }
/** * @param node * @param baseUrl * @param wordMLPackage * @return * @throws IOException */ public List<Object> convert(Node node, String baseUrl) throws Docx4JException { renderer = getRenderer(); if (node instanceof Document) { renderer.setDocument( (Document)node, baseUrl ); } else { Document doc = XmlUtils.neww3cDomDocument(); doc.importNode(node, true); renderer.setDocument( doc, baseUrl ); } renderer.layout(); traverse(renderer.getRootBox(), null); return imports.getContent(); }