[Practicalxml-commits] SF.net SVN: practicalxml:[160] branches/dev-1.1/src/main/java/net/sf/ pract
Brought to you by:
kdgregory
|
From: Auto-Generated S. C. M. <pra...@li...> - 2009-09-24 19:13:37
|
Revision: 160
http://practicalxml.svn.sourceforge.net/practicalxml/?rev=160&view=rev
Author: kdgregory
Date: 2009-09-24 19:13:30 +0000 (Thu, 24 Sep 2009)
Log Message:
-----------
JsonConverter: add method to convert to JSON using existing buffer
Modified Paths:
--------------
branches/dev-1.1/src/main/java/net/sf/practicalxml/converter/JsonConverter.java
Modified: branches/dev-1.1/src/main/java/net/sf/practicalxml/converter/JsonConverter.java
===================================================================
--- branches/dev-1.1/src/main/java/net/sf/practicalxml/converter/JsonConverter.java 2009-09-24 17:52:00 UTC (rev 159)
+++ branches/dev-1.1/src/main/java/net/sf/practicalxml/converter/JsonConverter.java 2009-09-24 19:13:30 UTC (rev 160)
@@ -94,7 +94,25 @@
*/
public static String convertToJson(Element root, Xml2JsonOptions... options)
{
- return new Xml2JsonConverter().convert(root, new StringBuilder(256))
- .toString();
+ return convertToJson(root, new StringBuilder(256), options).toString();
}
+
+
+ /**
+ * Creates a new JSON string from the the passed <code>Element</code>, and
+ * appends that string to the passed buffer (the buffer is actually passed
+ * into the JSON construction code).
+ *
+ * @param dom The source element -- this may or may not be the
+ * root element of its document.
+ * @param buf A buffer to which the JSON is appended.
+ * @param options Conversion options.
+ *
+ * @return The buffer, as a convenience for chained calls.
+ */
+ public static StringBuilder convertToJson(
+ Element root, StringBuilder buf, Xml2JsonOptions... options)
+ {
+ return new Xml2JsonConverter(options).convert(root,buf);
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|