dion 2004/09/05 05:00:25
Modified: jelly/src/java/org/apache/commons/jelly/tags/core
FileTag.java
jelly/src/java/org/apache/commons/jelly TagSupport.java
Log:
Pull up escaping of text to TagSupport
Revision Changes Path
1.14 +0 -21
jakarta-commons/jelly/src/java/org/apache/commons/jelly/tags/core/FileTag.java
Index: FileTag.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/jelly/src/java/org/apache/commons/jelly/tags/core/FileTag.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- FileTag.java 24 Feb 2004 14:10:38 -0000 1.13
+++ FileTag.java 5 Sep 2004 12:00:24 -0000 1.14
@@ -46,9 +46,6 @@
private boolean prettyPrint;
private String encoding;
- // should text be escaped - default to true for compatability
- private boolean escapeText = true;
-
public FileTag(){
}
@@ -132,24 +129,6 @@
public void setVar(String var) {
this.var = var;
}
-
- /**
- * Returns whether the body of this tag will be escaped or not.
- */
- public boolean isEscapeText() {
- return escapeText;
- }
-
- /**
- * Sets whether the body of the tag should be escaped as text (so that < and
> are
- * escaped as &lt; and &gt;), which is the default or leave the text as
XML.
- */
- public void setEscapeText(boolean escapeText) {
- this.escapeText = escapeText;
- }
-
- // Implementation methods
- //-------------------------------------------------------------------------
/**
* Writes the body fo this tag to the given Writer
1.31 +21 -5
jakarta-commons/jelly/src/java/org/apache/commons/jelly/TagSupport.java
Index: TagSupport.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/jelly/src/java/org/apache/commons/jelly/TagSupport.java,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- TagSupport.java 12 Aug 2004 05:07:53 -0000 1.30
+++ TagSupport.java 5 Sep 2004 12:00:24 -0000 1.31
@@ -46,6 +46,9 @@
protected JellyContext context;
+ /** whether xml text should be escaped */
+ private boolean escapeText = true;
+
/**
* Searches up the parent hierarchy from the given tag
* for a Tag of the given type
@@ -219,9 +222,7 @@
* @return the text evaluation of the body
*/
protected String getBodyText() throws JellyTagException {
- StringWriter writer = new StringWriter();
- invokeBody(XMLOutput.createXMLOutput(writer));
- return writer.toString();
+ return getBodyText(escapeText);
}
/**
@@ -233,7 +234,7 @@
*/
protected String getBodyText(boolean shouldEscape) throws JellyTagException {
StringWriter writer = new StringWriter();
- invokeBody(XMLOutput.createXMLOutput(writer,shouldEscape));
+ invokeBody(XMLOutput.createXMLOutput(writer, shouldEscape));
return writer.toString();
}
@@ -291,4 +292,19 @@
}
}
}
+
+ /**
+ * Returns whether the body of this tag will be escaped or not.
+ */
+ public boolean isEscapeText() {
+ return escapeText;
+ }
+
+ /**
+ * Sets whether the body of the tag should be escaped as text (so that < and
> are
+ * escaped as &lt; and &gt;), which is the default or leave the text as
XML.
+ */
+ public void setEscapeText(boolean escapeText) {
+ this.escapeText = escapeText;
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]