@SuppressWarnings("unused") @Deprecated public static org.w3c.dom.Element convertToDOM(@NotNull Element e) { try { final Document d = new Document(); final Element newRoot = new Element(e.getName()); final List attributes = e.getAttributes(); for (Object o : attributes) { Attribute attr = (Attribute)o; newRoot.setAttribute(attr.getName(), attr.getValue(), attr.getNamespace()); } d.addContent(newRoot); newRoot.addContent(e.cloneContent()); return new DOMOutputter().output(d).getDocumentElement(); } catch (JDOMException e1) { throw new RuntimeException(e1); } }
public static org.w3c.dom.Element convertToDOM(@NotNull Element e) { try { final Document d = new Document(); final Element newRoot = new Element(e.getName()); final List attributes = e.getAttributes(); for (Object o : attributes) { Attribute attr = (Attribute)o; newRoot.setAttribute(attr.getName(), attr.getValue(), attr.getNamespace()); } d.addContent(newRoot); newRoot.addContent(e.cloneContent()); return new DOMOutputter().output(d).getDocumentElement(); } catch (JDOMException e1) { throw new RuntimeException(e1); } }
public org.w3c.dom.Document retrieveMetadata(int metadataId) throws Exception { request.setUrl(new URL(serverUrl + "/srv/eng/xml.metadata.get")); request.clearParams(); request.addParam("id", metadataId); Element md = request.execute(); Element info = md.getChild("info", GEONET_NS); if (info != null) { info.detach(); } Document doc = new Document(md); DOMOutputter domOutputter = new DOMOutputter(); org.w3c.dom.Document document = domOutputter.output(doc); return document; }
@SuppressWarnings("unused") @Deprecated public static org.w3c.dom.Element convertToDOM(@Nonnull Element e) { try { final Document d = new Document(); final Element newRoot = new Element(e.getName()); final List attributes = e.getAttributes(); for (Object o : attributes) { Attribute attr = (Attribute)o; newRoot.setAttribute(attr.getName(), attr.getValue(), attr.getNamespace()); } d.addContent(newRoot); newRoot.addContent(e.cloneContent()); return new DOMOutputter().output(d).getDocumentElement(); } catch (JDOMException e1) { throw new RuntimeException(e1); } }
@SuppressWarnings("unchecked") public static RequestType unmarshalInvoiceRequest440(org.jdom.Document jdomDoc){ try { JAXBContext jaxbContext = JAXBContext.newInstance(RequestType.class); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); DOMOutputter outputter = new DOMOutputter(); Document document = outputter.output(jdomDoc); JAXBElement<Object> jaxElement = (JAXBElement<Object>) unmarshaller.unmarshal(document); if (jaxElement.getValue() instanceof RequestType) { RequestType request = (RequestType) jaxElement.getValue(); return request; } } catch (JDOMException | JAXBException e) { log.error("Unmarshalling generalInvoiceRequest_440 from jDom document failed", e); } return null; }
/** * Constructs an XmlStringBuffer whose initial value is Document * * @param jdomDoc * * @deprecated using XmlStringBuffer(org.w3c.dom.Document document) instead. */ public XmlStringBuffer(org.jdom.Document jdomDoc) { try { this.document = new DOMOutputter().output(jdomDoc); } catch(JDOMException e) { log.error(e.getMessage(), e); } }
public static MessageElement fromElement(Element elem) throws JDOMException { Document doc = new Document(elem); org.w3c.dom.Document tempDoc = new DOMOutputter().output(doc); return new MessageElement(tempDoc.getDocumentElement()); }
/** * Creates a W3C DOM document for the given WireFeed. * <p> * This method does not use the feed encoding property. * <p> * NOTE: This method delages to the 'Document WireFeedOutput#outputJDom(WireFeed)'. * <p> * @param feed Abstract feed to create W3C DOM document from. The type of the WireFeed must match * the type given to the FeedOuptut constructor. * @return the W3C DOM document for the given WireFeed. * @throws IllegalArgumentException thrown if the feed type of the WireFeedOutput and WireFeed don't match. * @throws FeedException thrown if the W3C DOM document for the feed could not be created. * */ public org.w3c.dom.Document outputW3CDom(WireFeed feed) throws IllegalArgumentException,FeedException { Document doc = outputJDom(feed); DOMOutputter outputter = new DOMOutputter(); try { return outputter.output(doc); } catch (JDOMException jdomEx) { throw new FeedException("Could not create DOM",jdomEx); } }