public class ChainingXmlWriter extends Object
Ezvcard.writeXml(Collection),
Ezvcard.writeXml(VCard...)| Constructor and Description |
|---|
ChainingXmlWriter(Collection<VCard> vcards) |
| Modifier and Type | Method and Description |
|---|---|
Document |
dom()
Generates an XML document object model (DOM) containing the xCards.
|
String |
go()
Writes the xCards to a string.
|
void |
go(OutputStream out)
Writes the xCards to an output stream.
|
void |
go(Path file)
Writes the xCards to a file.
|
void |
go(Writer writer)
Writes the xCards to a writer.
|
ChainingXmlWriter |
indent(Integer indent)
Sets the number of indent spaces to use for pretty-printing.
|
ChainingXmlWriter |
outputProperties(Map<String,String> outputProperties)
Assigns all of the given output properties to the JAXP transformer (see
Transformer.setOutputProperty(java.lang.String, java.lang.String)). |
ChainingXmlWriter |
outputProperty(String name,
String value)
Assigns an output property to the JAXP transformer (see
Transformer.setOutputProperty(java.lang.String, java.lang.String)). |
ChainingXmlWriter |
prodId(boolean include)
Sets whether to add a
ProductId property to each vCard that marks
it as having been generated by this library. |
ChainingXmlWriter |
register(String parameterName,
VCardDataType dataType)
Registers the data type of a non-standard parameter.
|
ChainingXmlWriter |
register(VCardPropertyScribe<? extends VCardProperty> scribe)
Registers a property scribe.
|
ChainingXmlWriter |
versionStrict(boolean versionStrict)
Sets whether to exclude properties that do not support the target version
from the written vCard.
|
ChainingXmlWriter |
xmlVersion(String xmlVersion)
Sets the XML version to use.
|
public ChainingXmlWriter(Collection<VCard> vcards)
vcards - the vCards to writepublic ChainingXmlWriter indent(Integer indent)
indent - the number of spaces in the indent string or null not to
pretty-print (disabled by default)public ChainingXmlWriter xmlVersion(String xmlVersion)
xmlVersion - the XML version (defaults to "1.0")public ChainingXmlWriter outputProperty(String name, String value)
Transformer.setOutputProperty(java.lang.String, java.lang.String)).name - the property namevalue - the property valuepublic ChainingXmlWriter outputProperties(Map<String,String> outputProperties)
Transformer.setOutputProperty(java.lang.String, java.lang.String)).outputProperties - the propertiespublic ChainingXmlWriter prodId(boolean include)
ProductId property to each vCard that marks
it as having been generated by this library. For 2.1 vCards, the extended
property "X-PRODID" will be added, since ProductId is not
supported by that version.include - true to add the property, false not to (defaults to true)public ChainingXmlWriter versionStrict(boolean versionStrict)
versionStrict - true to exclude such properties, false not to
(defaults to true)public ChainingXmlWriter register(VCardPropertyScribe<? extends VCardProperty> scribe)
scribe - the scribe to registerpublic ChainingXmlWriter register(String parameterName, VCardDataType dataType)
parameterName - the parameter name (e.g. "x-foo")dataType - the data typepublic void go(OutputStream out) throws TransformerException
out - the output stream to write toTransformerException - if there's a problem writing to the output
streampublic void go(Path file) throws IOException, TransformerException
file - the file to write toIOException - if the file can't be openedTransformerException - if there's a problem writing to the filepublic void go(Writer writer) throws TransformerException
writer - the writer to write toTransformerException - if there's a problem writing to the writerCopyright © 2012–2023 Michael Angstadt. All rights reserved.