minchau 2003/07/09 14:02:32
Modified: java/src/org/apache/xml/serializer ToHTMLStream.java
ToStream.java
Log:
Reduce the indentation level of end-element tags by 1 level.
PR: bugzilla 21449
Submitted by: Brian Minchau
Revision Changes Path
1.21 +1 -1 xml-xalan/java/src/org/apache/xml/serializer/ToHTMLStream.java
Index: ToHTMLStream.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/serializer/ToHTMLStream.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- ToHTMLStream.java 8 Jul 2003 23:24:43 -0000 1.20
+++ ToHTMLStream.java 9 Jul 2003 21:02:31 -0000 1.21
@@ -870,7 +870,7 @@
shouldIndent = true;
}
if (!m_elemContext.m_startTagOpen && shouldIndent)
- indent();
+ indent(m_elemContext.m_currentElemDepth - 1);
m_inBlockElem = !isBlockElement;
}
1.17 +15 -4 xml-xalan/java/src/org/apache/xml/serializer/ToStream.java
Index: ToStream.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/serializer/ToStream.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- ToStream.java 7 Jul 2003 06:23:51 -0000 1.16
+++ ToStream.java 9 Jul 2003 21:02:31 -0000 1.17
@@ -772,11 +772,13 @@
/**
* Might print a newline character and the indentation amount
- * of the current element.
+ * of the given depth.
+ *
+ * @param depth the indentation depth (element nesting depth)
*
* @throws org.xml.sax.SAXException if an error occurs during writing.
*/
- protected void indent() throws IOException
+ protected void indent(int depth) throws IOException
{
if (m_startNewLine)
@@ -786,9 +788,18 @@
* will run faster in that situation.
*/
if (m_indentAmount > 0)
- printSpace(m_elemContext.m_currentElemDepth * m_indentAmount);
+ printSpace(depth * m_indentAmount);
}
+
+ /**
+ * Indent at the current element nesting depth.
+ * @throws IOException
+ */
+ protected void indent() throws IOException
+ {
+ indent(m_elemContext.m_currentElemDepth);
+ }
/**
* Prints <var>n</var> spaces.
* @param pw The character output stream to use.
@@ -2019,7 +2030,7 @@
closeCDATA();
if (shouldIndent())
- indent();
+ indent(m_elemContext.m_currentElemDepth - 1);
writer.write('<');
writer.write('/');
writer.write(name);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]