/** * Creates a new XMLWriter, ready to write an XML document to the specified * writer. The root element in the XML document will specify an xmlns * attribute with the specified namespace parameter. * * @param w * The writer this XMLWriter will write to. * @param xmlns * The XML namespace to include in the xmlns attribute of the * root element. */ public XMLWriter(Writer w, String xmlns) { this.writer = w; this.xmlns = xmlns; append(PROLOG); }
/** * Starts a new element with the specified name at the current position in * the in-progress XML document. * * @param element * The name of the new element. * * @return This XMLWriter so that additional method calls can be chained * together. */ public XMLWriter startElement(String element) { append("<" + element); if (rootElement && xmlns != null) { append(" xmlns=\"" + xmlns + "\""); rootElement = false; } append(">"); elementStack.push(element); return this; }
/** * Adds the specified value as text to the current position of the in * progress XML document. * * @param s * The text to add to the XML document. * * @return This XMLWriter so that additional method calls can be chained * together. */ public XMLWriter value(String s) { append(escapeXMLEntities(s)); return this; }
/** * Adds the string representation of the specified object to the current * position of the in progress XML document. * * @param obj * The object to translate to a string and add to the XML * document. * * @return This XMLWriter so that additional method calls can be chained * together. */ public XMLWriter value(Object obj) { append(escapeXMLEntities(obj.toString())); return this; }
/** * Adds the specified date as text to the current position of the * in-progress XML document. * * @param date * The date to add to the XML document. * * @return This XMLWriter so that additional method calls can be chained * together. */ public XMLWriter value(Date date) { append(escapeXMLEntities(StringUtils.fromDate(date))); return this; }
/** * Adds the specified value as Base64 encoded text to the current position of the in * progress XML document. * * @param b * The binary data to add to the XML document. * * @return This XMLWriter so that additional method calls can be chained * together. */ public XMLWriter value(ByteBuffer b) { append(escapeXMLEntities(Base64.encodeAsString(BinaryUtils.copyBytesFrom(b)))); return this; }
/** * Creates a new XMLWriter, ready to write an XML document to the specified * writer. The root element in the XML document will specify an xmlns * attribute with the specified namespace parameter. * * @param w The writer this XMLWriter will write to. * @param xmlns The XML namespace to include in the xmlns attribute of the * root element. */ public XMLWriter(Writer w, String xmlns) { this.writer = w; this.xmlns = xmlns; append(PROLOG); }
/** * Creates a new XMLWriter, ready to write an XML document to the specified * writer. The root element in the XML document will specify an xmlns * attribute with the specified namespace parameter. * * @param w * The writer this XMLWriter will write to. * @param xmlns * The XML namespace to include in the xmlns attribute of the * root element. */ public XMLWriter(Writer w, String xmlns) { this.writer = w; this.xmlns = xmlns; append(PROLOG); }
/** * Adds the specified value as text to the current position of the in * progress XML document. * * @param s The text to add to the XML document. * @return This XMLWriter so that additional method calls can be chained * together. */ public XMLWriter value(String s) { append(escapeXMLEntities(s)); return this; }
/** * Adds the string representation of the specified object to the current * position of the in progress XML document. * * @param obj The object to translate to a string and add to the XML * document. * @return This XMLWriter so that additional method calls can be chained * together. */ public XMLWriter value(Object obj) { append(escapeXMLEntities(obj.toString())); return this; }
/** * Starts a new element with the specified name at the current position in * the in-progress XML document. * * @param element The name of the new element. * @return This XMLWriter so that additional method calls can be chained * together. */ public XMLWriter startElement(String element) { append("<" + element); if (rootElement && xmlns != null) { append(" xmlns=\"" + xmlns + "\""); rootElement = false; } append(">"); elementStack.push(element); return this; }
/** * Starts a new element with the specified name at the current position in * the in-progress XML document. * * @param element * The name of the new element. * * @return This XMLWriter so that additional method calls can be chained * together. */ public XMLWriter startElement(String element) { append("<" + element); if (rootElement && xmlns != null) { append(" xmlns=\"" + xmlns + "\""); rootElement = false; } append(">"); elementStack.push(element); return this; }
/** * Adds the specified value as text to the current position of the in * progress XML document. * * @param s * The text to add to the XML document. * * @return This XMLWriter so that additional method calls can be chained * together. */ public XMLWriter value(String s) { append(escapeXMLEntities(s)); return this; }
/** * Adds the string representation of the specified object to the current * position of the in progress XML document. * * @param obj * The object to translate to a string and add to the XML * document. * * @return This XMLWriter so that additional method calls can be chained * together. */ public XMLWriter value(Object obj) { append(escapeXMLEntities(obj.toString())); return this; }
/** * Adds the specified date as text to the current position of the * in-progress XML document. * * @param date The date to add to the XML document. * @return This XMLWriter so that additional method calls can be chained * together. */ public XMLWriter value(Date date) { append(escapeXMLEntities(StringUtils.fromDate(date))); return this; }
/** * Adds the specified date as text to the current position of the * in-progress XML document. * * @param date * The date to add to the XML document. * * @return This XMLWriter so that additional method calls can be chained * together. */ public XMLWriter value(Date date) { append(escapeXMLEntities(StringUtils.fromDate(date))); return this; }
/** * Adds the specified value as Base64 encoded text to the current position of the in * progress XML document. * * @param b * The binary data to add to the XML document. * * @return This XMLWriter so that additional method calls can be chained * together. */ public XMLWriter value(ByteBuffer b) { append(escapeXMLEntities(Base64.encodeAsString(BinaryUtils.copyBytesFrom(b)))); return this; }
/** * Adds the specified value as text to the current position of the in * progress XML document. * * @param s The text to add to the XML document. * @return This XMLWriter so that additional method calls can be chained * together. */ public XMLWriter value(String s) { append(escapeXMLEntities(s)); return this; }
/** * Adds the specified date as text to the current position of the * in-progress XML document. * * @param date The date to add to the XML document. * @return This XMLWriter so that additional method calls can be chained * together. */ public XMLWriter value(Date date) { append(escapeXMLEntities(StringUtils.fromDate(date))); return this; }
/** * Adds the specified date as text to the current position of the * in-progress XML document. * * @param date The date to add to the XML document. * @return This XMLWriter so that additional method calls can be chained * together. */ public XMLWriter value(Date date) { append(escapeXMLEntities(StringUtils.fromDate(date))); return this; }