public void addContent(Parent parent, Content child) { if (parent instanceof Document) { ((Document) parent).addContent(child); } else { ((Element) parent).addContent(child); } }
public XslFoDocumentBuilder() { document = new Document(); // create root element Element e = new Element("root", ns); document.addContent(e); }
/** * Creates a basic XMLVM document. */ private static Document createDocument() { Element root= new Element("xmlvm", NS_XMLVM); root.addNamespaceDeclaration(NS_DEX); Document document= new Document(); document.addContent(root); return document; }
public void write() { final Document doc = new Document(); final Element root = new Element("driverConfiguration"); doc.addContent(root);
tempDoc.addContent(document.cloneContent()); for (Entry<String, List<String>> entry : regexes.entrySet()) {
private static GeoCoding createGeoCodingFromElement(Product product, Element element) { final Content content = element.detach(); final GeoCoding[] geoCodings = createGeoCoding(new Document().addContent(content), product); if (geoCodings == null) { return null; } return geoCodings[0]; }
@Override public void serialize( @NotNull T object, @NotNull OutputStream out, @Nullable C context ) throws IOException { Document document = new Document(); //Add the format version document.addContent( new ProcessingInstruction( PI_TARGET_FORMAT, getFormatVersion().toString() ) ); //Create the root Element root = new Element( getDefaultElementName() ); document.setRootElement( root ); serialize( root, object, context ); new XMLOutputter( Format.getPrettyFormat().setLineSeparator( LINE_SEPARATOR ) ).output( document, out ); }
/** * Creates document with documentation data from class javadocs * @param clazz * @return */ private Document generateClassDocumentation(JavaClass clazz) { Document document = new Document(); Element service = new Element("service"); document.addContent(service); // process class commment if (!"".equals(clazz.getComment())) { service.addContent(newDocElement(clazz.getComment())); } // process methods JavaMethod methods[] = clazz.getMethods(); for (int m = 0; m < methods.length; m++) { Element methodElem = generateMethod(methods[m]); if (methodElem != null) { service.addContent(methodElem); } } return document; }
tempDoc.addContent(document.cloneContent());
tempDoc.addContent(document.cloneContent());
private static GeoCoding createPixelGeoCoding(Product product, Datum datum, Element geoPosElem) { final String latBandName = geoPosElem.getChildTextTrim(DimapProductConstants.TAG_LATITUDE_BAND); final String lonBandName = geoPosElem.getChildTextTrim(DimapProductConstants.TAG_LONGITUDE_BAND); final Band latBand = product.getBand(latBandName); final Band lonBand = product.getBand(lonBandName); final Element searchRadiusElem = geoPosElem.getChild(DimapProductConstants.TAG_SEARCH_RADIUS); int searchRadius = Integer.parseInt(searchRadiusElem.getTextTrim()); if (searchRadius == 0) { searchRadius = 6; } String validMask = null; if (geoPosElem.getChild(DimapProductConstants.TAG_VALID_MASK_EXPRESSION) != null) { validMask = geoPosElem.getChildTextTrim(DimapProductConstants.TAG_VALID_MASK_EXPRESSION); } final Element posEstimatorElement = geoPosElem.getChild(DimapProductConstants.TAG_PIXEL_POSITION_ESTIMATOR); if (posEstimatorElement != null) { final Content posEstimatorContent = posEstimatorElement.detach(); final Document dom = new Document(); dom.addContent(posEstimatorContent); product.setGeoCoding(createGeoCoding(dom, product)[0]); } return GeoCodingFactory.createPixelGeoCoding(latBand, lonBand, validMask, searchRadius); }
doc.addContent(root.detach());
Element clone = (Element)child.clone(); Document doc = new Document(); doc.addContent(clone.detach()); outputter.output(doc, bos); ByteArrayInputStream in = new ByteArrayInputStream(bos.toByteArray());
if (isPerComponentDOM) { tempDoc = new Document(); tempDoc.addContent(doc.cloneContent()); if (isPerPipelineDOM) { tempDoc = new Document(); tempDoc.addContent(doc.cloneContent());