haul 2002/12/03 08:44:34 Modified: src/java/org/apache/cocoon/transformation SimpleFormTransformer.java Log: <action dev="CH" type="fix" fixes-bug="14739"> Fixed SimpleFormTransformer: Malformed XML with textarea elements. </action> Revision Changes Path 1.3 +15 -8 xml-cocoon2/src/java/org/apache/cocoon/transformation/SimpleFormTransformer.java Index: SimpleFormTransformer.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/transformation/SimpleFormTransformer.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- SimpleFormTransformer.java 17 Nov 2002 18:00:02 -0000 1.2 +++ SimpleFormTransformer.java 3 Dec 2002 16:44:34 -0000 1.3 @@ -121,7 +121,7 @@ * <table> * <tr><td>fixed</td><td>(boolean) Do not change values</td></tr> * <tr><td>prefix</td><td>(String) Added to the input element's name</td></tr> - * <tr><td>postfix</td><td>(String) Added to the input element's name</td></tr> + * <tr><td>suffix</td><td>(String) Added to the input element's name</td></tr> * <tr><td>input</td><td>(String) InputModule name</td></tr> * </table> * </p> @@ -215,6 +215,9 @@ /** nesting level of ignored elements */ protected int ignoreCount; + /** ignored element needs closing tag */ + protected boolean ignoreThis = false; + /** stack of ignored element names */ protected Stack stack = new Stack(); @@ -237,7 +240,7 @@ private boolean fixed = false; private String prefix = null; - private String postfix = null; + private String suffix = null; private String defaultInput = "request-param"; private Configuration defaultInputConf = null; @@ -303,7 +306,7 @@ this.parameters = par; this.fixed = par.getParameterAsBoolean("fixed",false); this.prefix = par.getParameter("prefix",null); - this.postfix = par.getParameter("postfix",null); + this.suffix = par.getParameter("suffix",null); this.inputName = par.getParameter("input",null); this.inputConf = null; this.validationResults = XSPFormValidatorHelper.getResults(objectModel); @@ -456,7 +459,7 @@ getLogger().debug("replacing"); if (this.prefix != null) aName = this.prefix + aName; - if (this.postfix != null) aName = aName + this.postfix; + if (this.suffix != null) aName = aName + this.suffix; this.values = this.getValues(aName); AttributesImpl attributes = null; @@ -496,7 +499,7 @@ getLogger().debug("startSelectElement "+name+" attributes "+this.printAttributes(attr)); if (aName != null && !(this.fixed || (fixed != null && parseBoolean(fixed)))) { if (this.prefix != null) aName = this.prefix + aName; - if (this.postfix != null) aName = aName + this.postfix; + if (this.suffix != null) aName = aName + this.suffix; this.values = this.getValues(aName); } super.startElement(uri, name, raw, attr); @@ -561,7 +564,7 @@ getLogger().debug("startTextareaElement "+name+" attributes "+this.printAttributes(attributes)); if (aName != null) { if (this.prefix != null) aName = this.prefix + aName; - if (this.postfix != null) aName = aName + this.postfix; + if (this.suffix != null) aName = aName + this.suffix; value = this.getValues(aName); } if (value == null || this.fixed || (fixed != null && parseBoolean(fixed))) { @@ -599,7 +602,7 @@ super.startElement(uri, name, raw, attr); } else { if (this.prefix != null) aName = this.prefix + aName; - if (this.postfix != null) aName = aName + this.postfix; + if (this.suffix != null) aName = aName + this.suffix; ValidatorActionResult validation = XSPFormValidatorHelper.getParamResult(this.objectModel, aName); String when = attr.getValue("when"); String when_ge = attr.getValue("when-ge"); @@ -622,6 +625,7 @@ } else { this.ignoreCount++; this.stack.push(name); + this.ignoreThis = true; }; } } @@ -695,6 +699,9 @@ this.stack.pop(); this.ignoreCount--; } + } + if (this.ignoreCount > 0 || (this.ignoreCount == 0 && this.ignoreThis)) { + this.ignoreThis = false; } else { switch (((Integer)elementNames.get(name,defaultElement)).intValue()) { case ELEMENT_INPUT:
---------------------------------------------------------------------- In case of troubles, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]