@Converter(generateBulkLoader=true) public class XmlConverter extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
defaultCharset |
static String |
DOCUMENT_BUILDER_FACTORY_FEATURE |
static String |
OUTPUT_PROPERTIES_PREFIX |
| Constructor and Description |
|---|
XmlConverter() |
XmlConverter(DocumentBuilderFactory documentBuilderFactory) |
| Modifier and Type | Method and Description |
|---|---|
void |
configureSaxonTransformerFactory(TransformerFactory factory)
Make a Saxon TransformerFactory more JAXP compliant by configuring it to send <xsl:message> output to the
ErrorListener.
|
Document |
createDocument() |
DocumentBuilder |
createDocumentBuilder() |
DocumentBuilder |
createDocumentBuilder(DocumentBuilderFactory factory) |
DocumentBuilderFactory |
createDocumentBuilderFactory() |
SAXParserFactory |
createSAXParserFactory() |
Transformer |
createTransformer() |
TransformerFactory |
createTransformerFactory() |
Properties |
defaultOutputProperties()
Returns the default set of output properties for conversions.
|
DocumentBuilderFactory |
getDocumentBuilderFactory() |
DocumentBuilderFactory |
getDocumentBuilderFactory(org.apache.camel.Exchange exchange) |
TransformerFactory |
getTransformerFactory() |
void |
setDocumentBuilderFactory(DocumentBuilderFactory documentBuilderFactory) |
void |
setTransformerFactory(TransformerFactory transformerFactory) |
protected void |
setupFeatures(DocumentBuilderFactory factory) |
Boolean |
toBoolean(NodeList list)
Converts the given NodeList to a boolean
|
byte[] |
toByteArray(Source source,
org.apache.camel.Exchange exchange)
Converts the given input Source into bytes
|
BytesSource |
toBytesSource(byte[] data)
Converts the given byte[] to a Source
|
Document |
toDOMDocument(byte[] data,
org.apache.camel.Exchange exchange)
Converts the given data to a DOM document
|
Document |
toDOMDocument(File file,
org.apache.camel.Exchange exchange)
Converts the given
File to a DOM document |
Document |
toDOMDocument(InputSource in,
org.apache.camel.Exchange exchange)
Converts the given
InputSource to a DOM document |
Document |
toDOMDocument(InputStream in,
org.apache.camel.Exchange exchange)
Converts the given
InputStream to a DOM document |
Document |
toDOMDocument(Node node)
Create a DOM document from the given Node.
|
Document |
toDOMDocument(Reader in,
org.apache.camel.Exchange exchange)
Converts the given
Reader to a DOM document |
Document |
toDOMDocument(Source source)
Create a DOM document from the given source.
|
Document |
toDOMDocument(String text,
org.apache.camel.Exchange exchange)
Converts the given
String to a DOM document |
Document |
toDOMDocumentFromSingleNodeList(NodeList nl)
Convert a NodeList consisting of just 1 node to a DOM Document.
|
Element |
toDOMElement(Node node)
Create a DOM element from the DOM node.
|
Element |
toDOMElement(Source source)
Create a DOM element from the given source.
|
Node |
toDOMNode(Source source)
Converts the given Source into a W3C DOM node
|
Node |
toDOMNodeFromSAX(SAXSource source) |
Node |
toDOMNodeFromSingleNodeList(NodeList nl)
Convert a NodeList consisting of just 1 node to a DOM Node.
|
Node |
toDOMNodeFromStAX(StAXSource source) |
DOMSource |
toDOMSource(byte[] bytes)
Converts the source instance to a
DOMSource or returns null if the conversion is not supported (making it
easy to derive from this class to add new kinds of conversion). |
DOMSource |
toDOMSource(Document document)
Converts the given Document to a DOMSource
|
DOMSource |
toDOMSource(File file,
org.apache.camel.Exchange exchange) |
DOMSource |
toDOMSource(InputStream is,
org.apache.camel.Exchange exchange) |
DOMSource |
toDOMSource(Node node)
Converts the given Node to a Source
|
DOMSource |
toDOMSource(Source source,
org.apache.camel.Exchange exchange)
Converts the source instance to a
DOMSource or returns null if the conversion is not supported (making it
easy to derive from this class to add new kinds of conversion). |
DOMSource |
toDOMSource(String text)
Converts the source instance to a
DOMSource or returns null if the conversion is not supported (making it
easy to derive from this class to add new kinds of conversion). |
DOMSource |
toDOMSourceFromSAX(SAXSource source) |
DOMSource |
toDOMSourceFromStAX(StAXSource source) |
DOMSource |
toDOMSourceFromStream(StreamSource source,
org.apache.camel.Exchange exchange) |
InputSource |
toInputSource(File file,
org.apache.camel.Exchange exchange) |
InputSource |
toInputSource(InputStream is,
org.apache.camel.Exchange exchange) |
InputStream |
toInputStream(Document dom,
org.apache.camel.Exchange exchange) |
InputStream |
toInputStream(DOMSource source,
org.apache.camel.Exchange exchange) |
InputStream |
toInputStream(StreamSource source) |
QName |
toQName(String str)
Converts the given string to a QName.
|
Reader |
toReader(StreamSource source) |
Reader |
toReaderFromSource(Source src,
org.apache.camel.Exchange exchange) |
void |
toResult(Source source,
Result result)
Converts the given input Source into the required result
|
void |
toResult(Source source,
Result result,
Properties outputProperties)
Converts the given input Source into the required result
|
SAXSource |
toSAXSource(byte[] in,
org.apache.camel.Exchange exchange)
Converts the source instance to a
SAXSource or returns null if the conversion is not supported (making it
easy to derive from this class to add new kinds of conversion). |
SAXSource |
toSAXSource(File file,
org.apache.camel.Exchange exchange)
Converts the source instance to a
SAXSource or returns null if the conversion is not supported (making it
easy to derive from this class to add new kinds of conversion). |
SAXSource |
toSAXSource(InputStream source,
org.apache.camel.Exchange exchange)
Converts the source instance to a
SAXSource or returns null if the conversion is not supported (making it
easy to derive from this class to add new kinds of conversion). |
SAXSource |
toSAXSource(Source source,
org.apache.camel.Exchange exchange)
Converts the source instance to a
SAXSource or returns null if the conversion is not supported (making it
easy to derive from this class to add new kinds of conversion). |
SAXSource |
toSAXSource(String source,
org.apache.camel.Exchange exchange)
Converts the source instance to a
SAXSource or returns null if the conversion is not supported (making it
easy to derive from this class to add new kinds of conversion). |
SAXSource |
toSAXSourceFromDOM(DOMSource source,
org.apache.camel.Exchange exchange) |
SAXSource |
toSAXSourceFromStAX(StAXSource source,
org.apache.camel.Exchange exchange) |
SAXSource |
toSAXSourceFromStream(StreamSource source,
org.apache.camel.Exchange exchange) |
Source |
toSource(byte[] in) |
Source |
toSource(Document document)
Converts the given Document to a Source
|
Source |
toSource(String data)
Converts the given String to a Source
|
StAXSource |
toStAXSource(byte[] in,
org.apache.camel.Exchange exchange)
Converts the source instance to a
StAXSource or returns null if the conversion is not supported (making
it easy to derive from this class to add new kinds of conversion). |
StAXSource |
toStAXSource(File file,
org.apache.camel.Exchange exchange)
Converts the source instance to a
StAXSource or returns null if the conversion is not supported (making
it easy to derive from this class to add new kinds of conversion). |
StAXSource |
toStAXSource(InputStream source,
org.apache.camel.Exchange exchange)
Converts the source instance to a
StAXSource or returns null if the conversion is not supported (making
it easy to derive from this class to add new kinds of conversion). |
StAXSource |
toStAXSource(String source,
org.apache.camel.Exchange exchange)
Converts the source instance to a
StAXSource or returns null if the conversion is not supported (making
it easy to derive from this class to add new kinds of conversion). |
StreamSource |
toStreamSource(byte[] in,
org.apache.camel.Exchange exchange) |
StreamSource |
toStreamSource(ByteBuffer in,
org.apache.camel.Exchange exchange) |
StreamSource |
toStreamSource(File in) |
StreamSource |
toStreamSource(InputStream in) |
StreamSource |
toStreamSource(Reader in) |
StreamSource |
toStreamSource(Source source,
org.apache.camel.Exchange exchange) |
StreamSource |
toStreamSource(String in) |
StreamSource |
toStreamSourceFromDOM(DOMSource source,
org.apache.camel.Exchange exchange) |
StreamSource |
toStreamSourceFromSAX(SAXSource source,
org.apache.camel.Exchange exchange) |
StreamSource |
toStreamSourceFromStAX(StAXSource source,
org.apache.camel.Exchange exchange) |
String |
toString(Source source,
org.apache.camel.Exchange exchange)
Converts the given input Source into text
|
String |
toStringFromDocument(Document document,
Properties outputOptions)
Converts the given Document to into text
|
StringSource |
toStringSource(String data)
Converts the given String to a Source
|
public static final String OUTPUT_PROPERTIES_PREFIX
public static final String DOCUMENT_BUILDER_FACTORY_FEATURE
public static String defaultCharset
public XmlConverter()
public XmlConverter(DocumentBuilderFactory documentBuilderFactory)
public Properties defaultOutputProperties()
public void toResult(Source source, Result result) throws TransformerException
TransformerExceptionpublic void toResult(Source source, Result result, Properties outputProperties) throws TransformerException
TransformerException@Converter(order=2) public Boolean toBoolean(NodeList list)
@Converter(order=3) public BytesSource toBytesSource(byte[] data)
@Converter(order=4) public StringSource toStringSource(String data)
@Converter(order=5) public DOMSource toDOMSource(Document document)
@Converter(order=6) public DOMSource toDOMSource(Node node) throws ParserConfigurationException, TransformerException
@Converter(order=7) public Source toSource(String data)
@Converter(order=8) public Source toSource(byte[] in)
@Converter(order=9) public Source toSource(Document document)
@Converter(order=10) public String toString(Source source, org.apache.camel.Exchange exchange) throws TransformerException
TransformerException@Converter(order=11) public byte[] toByteArray(Source source, org.apache.camel.Exchange exchange) throws TransformerException
TransformerException@Converter(order=12) public DOMSource toDOMSource(String text) throws ParserConfigurationException, IOException, SAXException, TransformerException
DOMSource or returns null if the conversion is not supported (making it
easy to derive from this class to add new kinds of conversion).@Converter(order=13) public DOMSource toDOMSource(byte[] bytes) throws IOException, SAXException, ParserConfigurationException
DOMSource or returns null if the conversion is not supported (making it
easy to derive from this class to add new kinds of conversion).@Converter(order=14) public SAXSource toSAXSource(String source, org.apache.camel.Exchange exchange) throws IOException, SAXException, TransformerException
SAXSource or returns null if the conversion is not supported (making it
easy to derive from this class to add new kinds of conversion).@Converter(order=15) public StAXSource toStAXSource(String source, org.apache.camel.Exchange exchange) throws XMLStreamException
StAXSource or returns null if the conversion is not supported (making
it easy to derive from this class to add new kinds of conversion).XMLStreamException@Converter(order=16) public StAXSource toStAXSource(byte[] in, org.apache.camel.Exchange exchange) throws XMLStreamException
StAXSource or returns null if the conversion is not supported (making
it easy to derive from this class to add new kinds of conversion).XMLStreamException@Converter(order=17) public SAXSource toSAXSource(InputStream source, org.apache.camel.Exchange exchange) throws IOException, SAXException, TransformerException
SAXSource or returns null if the conversion is not supported (making it
easy to derive from this class to add new kinds of conversion).@Converter(order=18) public SAXSource toSAXSource(byte[] in, org.apache.camel.Exchange exchange) throws IOException, SAXException, TransformerException
SAXSource or returns null if the conversion is not supported (making it
easy to derive from this class to add new kinds of conversion).@Converter(order=19) public StAXSource toStAXSource(InputStream source, org.apache.camel.Exchange exchange) throws XMLStreamException
StAXSource or returns null if the conversion is not supported (making
it easy to derive from this class to add new kinds of conversion).XMLStreamException@Converter(order=20) public SAXSource toSAXSource(File file, org.apache.camel.Exchange exchange) throws IOException, SAXException, TransformerException
SAXSource or returns null if the conversion is not supported (making it
easy to derive from this class to add new kinds of conversion).@Converter(order=21) public StAXSource toStAXSource(File file, org.apache.camel.Exchange exchange) throws FileNotFoundException, XMLStreamException
StAXSource or returns null if the conversion is not supported (making
it easy to derive from this class to add new kinds of conversion).@Converter(order=22) public StreamSource toStreamSource(String in)
@Converter(order=23) public StreamSource toStreamSource(InputStream in)
@Converter(order=24) public StreamSource toStreamSource(Reader in)
@Converter(order=25) public StreamSource toStreamSource(File in)
@Converter(order=26) public StreamSource toStreamSource(byte[] in, org.apache.camel.Exchange exchange) throws TransformerException
TransformerException@Converter(order=27) public StreamSource toStreamSource(ByteBuffer in, org.apache.camel.Exchange exchange) throws TransformerException
TransformerException@Converter(order=28) public StreamSource toStreamSourceFromSAX(SAXSource source, org.apache.camel.Exchange exchange) throws TransformerException
TransformerException@Converter(order=29) public StreamSource toStreamSourceFromDOM(DOMSource source, org.apache.camel.Exchange exchange) throws TransformerException
TransformerException@Converter(order=30) public StreamSource toStreamSourceFromStAX(StAXSource source, org.apache.camel.Exchange exchange) throws TransformerException
TransformerException@Converter(order=31) public SAXSource toSAXSourceFromStream(StreamSource source, org.apache.camel.Exchange exchange) throws SAXException
SAXException@Converter(order=32) public Reader toReader(StreamSource source)
@Converter(order=33) public Reader toReaderFromSource(Source src, org.apache.camel.Exchange exchange) throws TransformerException
TransformerException@Converter(order=34) public DOMSource toDOMSource(InputStream is, org.apache.camel.Exchange exchange) throws ParserConfigurationException, IOException, SAXException
@Converter(order=35) public DOMSource toDOMSource(File file, org.apache.camel.Exchange exchange) throws ParserConfigurationException, IOException, SAXException
@Converter(order=36) public DOMSource toDOMSourceFromStream(StreamSource source, org.apache.camel.Exchange exchange) throws ParserConfigurationException, IOException, SAXException
@Converter(order=37) public SAXSource toSAXSourceFromDOM(DOMSource source, org.apache.camel.Exchange exchange) throws TransformerException
TransformerException@Converter(order=38) public SAXSource toSAXSourceFromStAX(StAXSource source, org.apache.camel.Exchange exchange) throws TransformerException
TransformerException@Converter(order=39) public DOMSource toDOMSourceFromSAX(SAXSource source) throws TransformerException
TransformerException@Converter(order=40) public DOMSource toDOMSourceFromStAX(StAXSource source) throws TransformerException
TransformerException@Converter(order=41) public Node toDOMNodeFromSAX(SAXSource source) throws TransformerException
TransformerException@Converter(order=42) public Node toDOMNodeFromStAX(StAXSource source) throws TransformerException
TransformerException@Converter(order=43,
allowNull=true)
public Node toDOMNodeFromSingleNodeList(NodeList nl)
nl - the NodeList@Converter(order=44) public Document toDOMDocument(Node node) throws ParserConfigurationException, TransformerException
@Converter(order=45,
allowNull=true)
public Node toDOMNode(Source source)
throws TransformerException,
ParserConfigurationException,
IOException,
SAXException
@Converter(order=46) public Element toDOMElement(Source source) throws TransformerException, ParserConfigurationException, IOException, SAXException
@Converter(order=47) public Element toDOMElement(Node node) throws TransformerException
TransformerException@Converter(order=48) public Document toDOMDocument(byte[] data, org.apache.camel.Exchange exchange) throws IOException, SAXException, ParserConfigurationException
data - is the data to be parsedexchange - is the exchange to be used when calling the converterIOExceptionSAXExceptionParserConfigurationException@Converter(order=49) public Document toDOMDocument(InputStream in, org.apache.camel.Exchange exchange) throws IOException, SAXException, ParserConfigurationException
InputStream to a DOM documentin - is the data to be parsedexchange - is the exchange to be used when calling the converterIOExceptionSAXExceptionParserConfigurationException@Converter(order=50) public Document toDOMDocument(Reader in, org.apache.camel.Exchange exchange) throws IOException, SAXException, ParserConfigurationException
Reader to a DOM documentin - is the data to be parsedexchange - is the exchange to be used when calling the converterIOExceptionSAXExceptionParserConfigurationException@Converter(order=51) public Document toDOMDocument(InputSource in, org.apache.camel.Exchange exchange) throws IOException, SAXException, ParserConfigurationException
InputSource to a DOM documentin - is the data to be parsedexchange - is the exchange to be used when calling the converterIOExceptionSAXExceptionParserConfigurationException@Converter(order=52) public Document toDOMDocument(String text, org.apache.camel.Exchange exchange) throws IOException, SAXException, ParserConfigurationException
String to a DOM documenttext - is the data to be parsedexchange - is the exchange to be used when calling the converterIOExceptionSAXExceptionParserConfigurationException@Converter(order=53) public Document toDOMDocument(File file, org.apache.camel.Exchange exchange) throws IOException, SAXException, ParserConfigurationException
File to a DOM documentfile - is the data to be parsedexchange - is the exchange to be used when calling the converterIOExceptionSAXExceptionParserConfigurationException@Converter(order=54) public Document toDOMDocument(Source source) throws TransformerException, ParserConfigurationException, IOException, SAXException
@Converter(order=55,
allowNull=true)
public Document toDOMDocumentFromSingleNodeList(NodeList nl)
throws ParserConfigurationException,
TransformerException
nl - the NodeListParserConfigurationExceptionTransformerException@Converter(order=56) public InputStream toInputStream(DOMSource source, org.apache.camel.Exchange exchange) throws TransformerException
TransformerException@Converter(order=57) public InputStream toInputStream(Document dom, org.apache.camel.Exchange exchange) throws TransformerException
TransformerException@Converter(order=58) public InputSource toInputSource(InputStream is, org.apache.camel.Exchange exchange)
@Converter(order=59) public InputSource toInputSource(File file, org.apache.camel.Exchange exchange) throws FileNotFoundException
FileNotFoundException@Converter(order=60) public DOMSource toDOMSource(Source source, org.apache.camel.Exchange exchange) throws ParserConfigurationException, IOException, SAXException, TransformerException
DOMSource or returns null if the conversion is not supported (making it
easy to derive from this class to add new kinds of conversion).@Converter(order=61) public SAXSource toSAXSource(Source source, org.apache.camel.Exchange exchange) throws IOException, SAXException, TransformerException
SAXSource or returns null if the conversion is not supported (making it
easy to derive from this class to add new kinds of conversion).@Converter(order=62) public StreamSource toStreamSource(Source source, org.apache.camel.Exchange exchange) throws TransformerException
TransformerException@Converter(order=63) public InputStream toInputStream(StreamSource source) throws IOException
IOExceptionpublic String toStringFromDocument(Document document, Properties outputOptions) throws TransformerException
document - The document to convertoutputOptions - The OutputKeys properties to control various aspects of the XML outputTransformerExceptionpublic DocumentBuilderFactory getDocumentBuilderFactory()
public void setDocumentBuilderFactory(DocumentBuilderFactory documentBuilderFactory)
public TransformerFactory getTransformerFactory()
public void setTransformerFactory(TransformerFactory transformerFactory)
protected void setupFeatures(DocumentBuilderFactory factory)
public DocumentBuilderFactory getDocumentBuilderFactory(org.apache.camel.Exchange exchange)
public DocumentBuilderFactory createDocumentBuilderFactory()
public DocumentBuilder createDocumentBuilder() throws ParserConfigurationException
ParserConfigurationExceptionpublic DocumentBuilder createDocumentBuilder(DocumentBuilderFactory factory) throws ParserConfigurationException
ParserConfigurationExceptionpublic Document createDocument() throws ParserConfigurationException
ParserConfigurationExceptionpublic Transformer createTransformer() throws TransformerConfigurationException
public TransformerFactory createTransformerFactory()
public void configureSaxonTransformerFactory(TransformerFactory factory)
factory - the TransformerFactorypublic SAXParserFactory createSAXParserFactory()
Apache Camel