(org.w3c.dom.Element) imageMetadata.getAsTree(GeoTiffConstants.GEOTIFF_IIO_METADATA_FORMAT_NAME); final Element element = new DOMBuilder().build(w3cElement);
org.w3c.dom.NodeList nodes = node.getChildNodes(); for (int i=0, size=nodes.getLength(); i<size; i++) { buildTree(nodes.item(i), doc, current, true); org.w3c.dom.Node item = children.item(i); if (item != null) { buildTree(item, doc, element, false); factory.addContent(current, build((org.w3c.dom.Text)node)); break; factory.addContent(current, build((org.w3c.dom.CDATASection)node)); break; factory.addContent(doc, build((org.w3c.dom.ProcessingInstruction)node)); } else { factory.addContent(current, build((org.w3c.dom.ProcessingInstruction)node)); factory.addContent(doc, build((org.w3c.dom.Comment)node)); } else { factory.addContent(current, build((org.w3c.dom.Comment)node)); factory.addContent(current, build((org.w3c.dom.EntityReference)node)); break; factory.addContent(doc, build((org.w3c.dom.DocumentType)node)); break;
/** * This will build a JDOM tree from an existing DOM tree. * * @param domDocument <code>org.w3c.dom.Document</code> object * @return <code>Document</code> - JDOM document object. */ public Document build(org.w3c.dom.Document domDocument) { Document doc = factory.document(null); buildTree(domDocument, doc, null, true); return doc; }
/** * This will build a JDOM Element from an existing DOM Element * * @param domElement <code> org.w3c.dom.Element</code> object * @return <code>Element</code> - JDOM Element object */ public org.jdom2.Element build(org.w3c.dom.Element domElement) { Document doc = factory.document(null); buildTree(domElement, doc, null, true); return doc.getRootElement(); }
Document getDocument( @Nonnull final MavenProject mavenProject ) { final File pomFile = mavenProject.getFile(); try { final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); factory.setExpandEntityReferences(false); factory.setFeature("http://xml.org/sax/features/external-general-entities", false); factory.setFeature("http://xml.org/sax/features/external-parameter-entities", false); final DocumentBuilder documentBuilder = factory.newDocumentBuilder(); return new DOMBuilder().build(documentBuilder.parse(pomFile)); } catch( final IOException | SAXException | ParserConfigurationException e ) { throw new UsageAnalyticsException(e); } } }
/** * Builds an WireFeed (RSS or Atom) from an W3C DOM document. * <p> * NOTE: This method delages to the 'AsbtractFeed WireFeedInput#build(org.jdom2.Document)'. * <p> * * @param document W3C DOM document to read to create the WireFeed. * @return the WireFeed read from the W3C DOM document. * @throws IllegalArgumentException thrown if feed type could not be understood by any of the * underlying parsers. * @throws FeedException if the feed could not be parsed * */ public WireFeed build(final org.w3c.dom.Document document) throws IllegalArgumentException, FeedException { final DOMBuilder domBuilder = new DOMBuilder(); try { final Document jdomDoc = domBuilder.build(document); return this.build(jdomDoc); } catch (final IllegalArgumentException ex) { throw ex; } catch (final Exception ex) { throw new ParsingFeedException("Invalid XML", ex); } }
/** * Builds an WireFeed (RSS or Atom) from an W3C DOM document. * <p> * NOTE: This method delages to the 'AsbtractFeed WireFeedInput#build(org.jdom2.Document)'. * <p> * @param document W3C DOM document to read to create the WireFeed. * @return the WireFeed read from the W3C DOM document. * @throws IllegalArgumentException thrown if feed type could not be understood by any of the underlying parsers. * @throws FeedException if the feed could not be parsed * */ public WireFeed build(org.w3c.dom.Document document) throws IllegalArgumentException,FeedException { DOMBuilder domBuilder = new DOMBuilder(); try { Document jdomDoc = domBuilder.build(document); return build(jdomDoc); } catch (IllegalArgumentException ex) { throw ex; } catch (Exception ex) { throw new ParsingFeedException("Invalid XML",ex); } }
/** * Builds an WireFeed (RSS or Atom) from an W3C DOM document. * <p> * NOTE: This method delages to the 'AsbtractFeed WireFeedInput#build(org.jdom2.Document)'. * <p> * * @param document W3C DOM document to read to create the WireFeed. * @return the WireFeed read from the W3C DOM document. * @throws IllegalArgumentException thrown if feed type could not be understood by any of the * underlying parsers. * @throws FeedException if the feed could not be parsed * */ public WireFeed build(final org.w3c.dom.Document document) throws IllegalArgumentException, FeedException { final DOMBuilder domBuilder = new DOMBuilder(); try { final Document jdomDoc = domBuilder.build(document); return this.build(jdomDoc); } catch (final IllegalArgumentException ex) { throw ex; } catch (final Exception ex) { throw new ParsingFeedException("Invalid XML", ex); } }
/** * Builds an WireFeed (RSS or Atom) from an W3C DOM document. * <p> * NOTE: This method delages to the 'AsbtractFeed WireFeedInput#build(org.jdom2.Document)'. * <p> * @param document W3C DOM document to read to create the WireFeed. * @return the WireFeed read from the W3C DOM document. * @throws IllegalArgumentException thrown if feed type could not be understood by any of the underlying parsers. * @throws FeedException if the feed could not be parsed * */ public WireFeed build(org.w3c.dom.Document document) throws IllegalArgumentException,FeedException { DOMBuilder domBuilder = new DOMBuilder(); try { Document jdomDoc = domBuilder.build(document); return build(jdomDoc); } catch (IllegalArgumentException ex) { throw ex; } catch (Exception ex) { throw new ParsingFeedException("Invalid XML",ex); } }
@Override protected Element resolveRequestPayloadArgument(MethodParameter parameter, Source requestPayload) throws Exception { if (requestPayload instanceof DOMSource) { Node node = ((DOMSource) requestPayload).getNode(); DOMBuilder domBuilder = new DOMBuilder(); if (node.getNodeType() == Node.ELEMENT_NODE) { return domBuilder.build((org.w3c.dom.Element) node); } else if (node.getNodeType() == Node.DOCUMENT_NODE) { Document document = domBuilder.build((org.w3c.dom.Document) node); return document.getRootElement(); } } // we have no other option than to transform JDOMResult jdomResult = new JDOMResult(); transform(requestPayload, jdomResult); return jdomResult.getDocument().getRootElement(); }
@Override protected Element resolveRequestPayloadArgument(MethodParameter parameter, Source requestPayload) throws Exception { if (requestPayload instanceof DOMSource) { Node node = ((DOMSource) requestPayload).getNode(); DOMBuilder domBuilder = new DOMBuilder(); if (node.getNodeType() == Node.ELEMENT_NODE) { return domBuilder.build((org.w3c.dom.Element) node); } else if (node.getNodeType() == Node.DOCUMENT_NODE) { Document document = domBuilder.build((org.w3c.dom.Document) node); return document.getRootElement(); } } // we have no other option than to transform JDOMResult jdomResult = new JDOMResult(); transform(requestPayload, jdomResult); return jdomResult.getDocument().getRootElement(); }
@Override protected Element resolveRequestPayloadArgument(MethodParameter parameter, Source requestPayload) throws Exception { if (requestPayload instanceof DOMSource) { Node node = ((DOMSource) requestPayload).getNode(); DOMBuilder domBuilder = new DOMBuilder(); if (node.getNodeType() == Node.ELEMENT_NODE) { return domBuilder.build((org.w3c.dom.Element) node); } else if (node.getNodeType() == Node.DOCUMENT_NODE) { Document document = domBuilder.build((org.w3c.dom.Document) node); return document.getRootElement(); } } // we have no other option than to transform JDOMResult jdomResult = new JDOMResult(); transform(requestPayload, jdomResult); return jdomResult.getDocument().getRootElement(); }
DOMBuilder domBuilder = new DOMBuilder(); if (node.getNodeType() == Node.ELEMENT_NODE) { return domBuilder.build((org.w3c.dom.Element) node); Document document = domBuilder.build((org.w3c.dom.Document) node); return document.getRootElement();
DOMBuilder domBuilder = new DOMBuilder(); if (node.getNodeType() == Node.ELEMENT_NODE) { return domBuilder.build((org.w3c.dom.Element) node); Document document = domBuilder.build((org.w3c.dom.Document) node); return document.getRootElement();
DOMBuilder domBuilder = new DOMBuilder(); if (node.getNodeType() == Node.ELEMENT_NODE) { return domBuilder.build((org.w3c.dom.Element) node); Document document = domBuilder.build((org.w3c.dom.Document) node); return document.getRootElement();
@Override public org.w3c.dom.Document merge(org.w3c.dom.Document[] sources) throws AbstractXmlMergeException { DOMBuilder domb = new DOMBuilder(); // to save all XML files as JDOM objects Document[] docs = new Document[sources.length]; for (int i = 0; i < sources.length; i++) { // ask JDOM to parse the given inputStream docs[i] = domb.build(sources[i]); } Document result = doMerge(docs); DOMOutputter outputter = new DOMOutputter(); try { return outputter.output(result); } catch (JDOMException e) { throw new DocumentException(result, e); } }
document = new DOMBuilder().build((org.w3c.dom.Document) node); element = null; element = new DOMBuilder().build((org.w3c.dom.Element) node);
DOMBuilder domBuilder = new DOMBuilder(); Element relatedItem = domBuilder.build(relatedItemW3C); XPathExpression<Element> xpathIdentifier = XPathFactory.instance().compile("mods:identifier", Filters.element(), null, MCRConstants.MODS_NAMESPACE, MCRConstants.XLINK_NAMESPACE);
LOGGER.error("conver dom error!", e); DOMBuilder in = new DOMBuilder(); Document jdomDoc = in.build(doc); return jdomDoc; } catch (Exception e) {