I have the following code, which I have taken from the Apache camel website:
XmlJsonDataFormat XmlJsonFormat = New XmlJsonDataFormat (); XmlJsonFormat.setEncoding ("UTF-8"); XmlJsonFormat.setForceTopLevelObject (true); XmlJsonFormat.setTrimSpaces (true); XmlJsonFormat.setRootName ("newRoot"); XmlJsonFormat.setSkipNamespaces (true); XmlJsonFormat.setRemoveNamespacePrefixes (true); XmlJsonFormat.setExpandableProperties (Arrays.asList ("D", "E")); // XML to JSON ("direct: marshal"). Marshall (xmlJsonFormat) .to ("Fake: json"); // 1
On the previous row (marked 1), I get a compilation error. I do not understand that the to
method is coming; There is no static import, and I have seen examples and postings on this site.
I do not know anything about camels, and to do it as a stand alone utility class is to do simple XML -> JSN conversion.
Does anyone help me to understand that what I have to do to make this snippet work is that anyone knows a simple XML about JSN converter?
A good idea to get started with anybody is to drive the camel through this beginner guide
Then you will know that to
is from a camel passage, and you have a RouteBuilder
class to use it.
No comments:
Post a Comment