[utilities COMMIT] /java-support/trunk/src/main/java/net/shibboleth/utilities/java/support/xml/SerializeSupport.java
noreply at shibboleth.net
noreply at shibboleth.net
Mon Oct 7 13:27:01 EDT 2013
Author: scantor
Date: Mon Oct 7 13:27:01 2013
New Revision: 452
URL: http://svn.shibboleth.net/view/utilities?rev=452&view=rev
Log:
Add a nodeToString method with LS parameters.
Modified:
java-support/trunk/src/main/java/net/shibboleth/utilities/java/support/xml/SerializeSupport.java
Modified: java-support/trunk/src/main/java/net/shibboleth/utilities/java/support/xml/SerializeSupport.java
URL: http://svn.shibboleth.net/view/utilities/java-support/trunk/src/main/java/net/shibboleth/utilities/java/support/xml/SerializeSupport.java?rev=452&r1=451&r2=452&view=diff
==============================================================================
--- java-support/trunk/src/main/java/net/shibboleth/utilities/java/support/xml/SerializeSupport.java (original)
+++ java-support/trunk/src/main/java/net/shibboleth/utilities/java/support/xml/SerializeSupport.java Mon Oct 7 13:27:01 2013
@@ -56,10 +56,24 @@
* @return the string representation of the node
*/
@Nonnull public static String nodeToString(@Nonnull final Node node) {
+ return nodeToString(node, null);
+ }
+
+ /**
+ * Converts a Node into a String using the DOM, level 3, Load/Save serializer.
+ *
+ * @param node the node to be written to a string
+ * @param serializerParams parameters to pass to the {@link DOMConfiguration} of the serializer instance, obtained
+ * via {@link LSSerializer#getDomConfig()}. May be null.
+ *
+ * @return the string representation of the node
+ */
+ @Nonnull public static String nodeToString(@Nonnull final Node node,
+ @Nullable final Map<String, Object> serializerParams) {
Constraint.isNotNull(node, "Node may not be null");
final ByteArrayOutputStream baout = new ByteArrayOutputStream();
- writeNode(node, baout);
+ writeNode(node, baout, serializerParams);
try {
return new String(baout.toByteArray(), "UTF-8");
} catch (UnsupportedEncodingException e) {
@@ -67,7 +81,7 @@
throw new RuntimeException(e);
}
}
-
+
/**
* Converts a Node into a String, using the DOM, level 3, Load/Save serializer. A serializer
* option of 'format-pretty-print=true' is used to produce the pretty-print formatting.
More information about the commits
mailing list