- /**
- * Serializes an XML document to a stream.
- *
- * @param aDocument Document to serialize.
- * @param aOs Output stream.
- *
- * @throws IOException DOCUMENT ME!
- */
- public static void serialize(Document aDocument, OutputStream aOs)
- throws IOException {
- XMLSerializer serializer = new XMLSerializer(aOs, new OutputFormat());
- serializer.serialize(aDocument);
- }
-
- /**
- * Serializes an XML document.
- *
- * @param aDocument Document to serialize.
- *
- * @return Serialized document.
- *
- * @throws IOException DOCUMENT ME!
- */
- public static String serialize(Document aDocument)
- throws IOException {
- ByteArrayOutputStream os = new ByteArrayOutputStream();
- serialize(aDocument, os);
-
- return os.toString();
- }
-
- /**
- * Converts a dom4j document into a w3c DOM document.
- *
- * @param aDocument Document to convert.
- *
- * @return W3C DOM document.
- *
- * @throws DocumentException DOCUMENT ME!
- */
- public static Document convert(org.dom4j.Document aDocument)
- throws DocumentException {
- return new DOMWriter().write(aDocument);
- }
-
- /**
- * Converts a W3C DOM document into a dom4j document.
- *
- * @param aDocument Document to convert.
- *
- * @return Dom4j document.
- */
- public static org.dom4j.Document convert(Document aDocument) {
- return new DOMReader().read(aDocument);
- }
-