@Override public void addContent(Parent parent, Content child) { if (parent instanceof Document) { ((Document) parent).addContent(child); } else { ((Element) parent).addContent(child); } }
/** * Read an Element off the ObjectInputStream. * * @see #writeObject(ObjectOutputStream) * @param in where to read the Element from. * @throws IOException if there is a reading problem. * @throws ClassNotFoundException when a class cannot be found */ private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); content = new ContentList(this); int cs = in.readInt(); while (--cs >= 0) { addContent((Content)in.readObject()); } }
document.addContent( factory.comment(stream.getText())); break; document.addContent(factory.processingInstruction( stream.getPITarget(), stream.getPIData())); break;
((javax.xml.stream.events.Comment)event).getText()); if (current == null) { document.addContent(comment); } else { current.addContent(comment); ((javax.xml.stream.events.ProcessingInstruction)event).getData()); if (current == null) { document.addContent(pi); } else { current.addContent(pi);
public String moveOfxElements(String xHtmlText) { Document doc = null; try {doc = JDomUtil.txtToDoc(xHtmlText);} catch (JDOMException e) {logger.error("",e);} Element rootElement = doc.getRootElement(); rootElement.detach(); ArrayList<Element> al = moveOfxElement(rootElement,"wikiinjection",0); if(al.size()>1){logger.warn("Moved Elements has a size>1 !!!");} rootElement=al.get(0); doc.addContent(rootElement); xHtmlText=JDomUtil.docToTxt(doc); return xHtmlText; }
/** * Add link to XSL stylesheet for displaying OAI response in web browser. */ private Document addXSLStyle(Document doc) { String styleSheet = MCROAIAdapter.PREFIX + getServletName() + ".ResponseStylesheet"; String xsl = MCRConfiguration.instance().getString(styleSheet, "oai/oai2.xsl"); if (!xsl.isEmpty()) { Map<String, String> pairs = new HashMap<>(); pairs.put("type", "text/xsl"); pairs.put("href", MCRFrontendUtil.getBaseURL() + xsl); doc.addContent(0, new ProcessingInstruction("xml-stylesheet", pairs)); } return doc; }
root.setAttribute("key", key); root.setText(result); doc.addContent(root); StringWriter sw = new StringWriter(); XMLOutputter outputter = new XMLOutputter(Format.getPrettyFormat());
/** * Get a single Table document. * * @param root root element for document * @return the TapSchema as a document to be rendered as XML */ protected Document getDocument(Element root) { root.addNamespaceDeclaration(xsi); root.addNamespaceDeclaration(vod); // ivoa convention but not allowed by the VODataService schema //root.setAttribute("version", "1.1"); Document document = new Document(); document.addContent(root); return document; }
public Document toXmlDocument() { DateFormat df = DateUtil.getDateFormat(DateUtil.IVOA_DATE_FORMAT, DateUtil.UTC); Namespace vosi = Namespace.getNamespace("vosi", VOSI.AVAILABILITY_NS_URI); Element eleAvailability = new Element("availability", vosi); Util.addChild(eleAvailability, vosi, "available", Boolean.toString(_status.isAvailable())); if (_status.getUpSince() != null) { Util.addChild(eleAvailability, vosi, "upSince", df.format(_status.getUpSince())); } if (_status.getDownAt() != null) { Util.addChild(eleAvailability, vosi, "downAt", df.format(_status.getDownAt())); } if (_status.getBackAt() != null) { Util.addChild(eleAvailability, vosi, "backAt", df.format(_status.getBackAt())); } if (_status.getNote() != null) { Util.addChild(eleAvailability, vosi, "note", _status.getNote()); } if (this._clientIP != null) { eleAvailability.addContent(new Comment(String.format("<clientip>%s</clientip>", this._clientIP))); } Document document = new Document(); document.addContent(eleAvailability); return document; }
/** * Creates an XML document (JDOM) for the given feed bean. * * @param feed the feed bean to generate the XML document from. * @return the generated XML document (JDOM). * @throws IllegalArgumentException thrown if the type of the given feed bean does not match with the type of the * WireFeedGenerator. * @throws FeedException thrown if the XML Document could not be created. */ @Override public Document generate(final WireFeed feed) throws IllegalArgumentException, FeedException { if (!(feed instanceof Opml)) { throw new IllegalArgumentException("Not an OPML file"); } final Opml opml = (Opml) feed; final Document doc = new Document(); final Element root = new Element("opml"); root.setAttribute("version", "1.0"); doc.addContent(root); final Element head = generateHead(opml); if (head != null) { root.addContent(head); } final Element body = new Element("body"); root.addContent(body); super.generateFeedModules(opml.getModules(), root); body.addContent(generateOutlines(opml.getOutlines())); return doc; }
eContents.setAttribute("mycoreobject", derObj.getOwnerID().toString()); eContents.setAttribute("mycorederivate", derObj.getId().toString()); doc.addContent(eContents); if (!path.endsWith("/")) { path += "/";
sourceFileElement.setAttribute("SOURCE", document.getAceSource()); sourceFileElement.setAttribute("TYPE", document.getAceType()); xml.addContent(sourceFileElement);
sourceFileElement.setAttribute("SOURCE", document.getAceSource()); sourceFileElement.setAttribute("TYPE", document.getAceType()); xml.addContent(sourceFileElement);