You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by di...@apache.org on 2007/06/01 18:25:39 UTC

svn commit: r543526 - /webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchema.java

Author: dims
Date: Fri Jun  1 09:25:37 2007
New Revision: 543526

URL: http://svn.apache.org/viewvc?view=rev&rev=543526
Log:
try a couple of more switches to pretty print the xml under different jdk's

Modified:
    webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchema.java

Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchema.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchema.java?view=diff&rev=543526&r1=543525&r2=543526
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchema.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchema.java Fri Jun  1 09:25:37 2007
@@ -25,10 +25,12 @@
 import javax.xml.transform.*;
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
 import java.io.Writer;
+import java.io.ByteArrayInputStream;
 
 
 /**
@@ -206,11 +208,24 @@
             xser.setExtReg(this.parent.getExtReg());
             Document[] serializedSchemas = xser.serializeSchema(schema, false);
             TransformerFactory trFac = TransformerFactory.newInstance();
+            try {
+                trFac.setAttribute("indent-number", "4");
+            } catch (IllegalArgumentException e) {
+            }
             Source source = new DOMSource(serializedSchemas[0]);
             Result result = new StreamResult(out);
             javax.xml.transform.Transformer tr = trFac.newTransformer();
             tr.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
+            tr.setOutputProperty(OutputKeys.METHOD, "xml");
             tr.setOutputProperty(OutputKeys.INDENT, "yes");
+            try {
+                tr.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
+            } catch (IllegalArgumentException e) {
+            }
+            try {
+                tr.setOutputProperty("{http://xml.apache.org/xalan}indent-amount", "4");
+            } catch (IllegalArgumentException e) {
+            }
             tr.transform(source, result);
             out.flush();
         } catch (TransformerConfigurationException e) {



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: commons-dev-help@ws.apache.org