Class JsonPrinter
java.lang.Object
org.libxmq.imp.XMQPrinter
org.libxmq.imp.JsonPrinter
Print the xmq DOM as json, a port of the printer in json.c (xmq_print_json).
See JsonParser for the conventions used to store xml in json.
-
Nested Class Summary
Nested classes/interfaces inherited from class XMQPrinter
XMQPrinter.ParseExceptionModifier and TypeClassDescriptionclassA parse error raised while printing. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringQuote a string like xmq_quote_as_c in text.c: backslash escapes for \\ \" \a \b \t \n \v \f \r and \xHH for other control characters.toJson(XmlDocument doc, OutputSettings os, boolean final_newline) Print the document as json, like xmq_print_json.Methods inherited from class XMQPrinter
print_node, toXmqModifier and TypeMethodDescriptionvoidprint_node(XMQPrintState ps, Object node, int align) Recursively prints a node, like C print_node.static StringPrint a node as xmq like the xmq command line does by default (indentation 4, no colors), without a final newline.
-
Constructor Details
-
JsonPrinter
public JsonPrinter()Creates the json printer.
-
-
Method Details
-
toJson
Print the document as json, like xmq_print_json. The document is first fixed up (text and entities in an element are collapsed into one text).- Parameters:
doc- The document.os- The output settings.final_newline- Add a final newline.- Returns:
- The json.
-
quote
-