cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject cvs commit: cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/util DomHelper.java
Date Thu, 13 Nov 2003 13:19:10 GMT
bruno       2003/11/13 05:19:10

  Modified:    src/blocks/woody/java/org/apache/cocoon/woody/datatype
                        DefaultSelectionListBuilder.java
                        StaticSelectionList.java ValidationError.java
               src/blocks/woody/java/org/apache/cocoon/woody/datatype/validationruleimpl
                        AbstractValidationRule.java
                        AbstractValidationRuleBuilder.java
               src/blocks/woody/java/org/apache/cocoon/woody/formmodel
                        AbstractWidgetDefinition.java
                        AbstractWidgetDefinitionBuilder.java
                        AggregateFieldDefinition.java
                        AggregateFieldDefinitionBuilder.java
               src/blocks/woody/java/org/apache/cocoon/woody/util
                        DomHelper.java
  Log:
  Replaced direct dependencies on XMLByteStream recording stuff by XMLizable interface.
  
  Revision  Changes    Path
  1.2       +3 -2      cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/datatype/DefaultSelectionListBuilder.java
  
  Index: DefaultSelectionListBuilder.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/datatype/DefaultSelectionListBuilder.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DefaultSelectionListBuilder.java	22 Oct 2003 20:22:07 -0000	1.1
  +++ DefaultSelectionListBuilder.java	13 Nov 2003 13:19:09 -0000	1.2
  @@ -63,6 +63,7 @@
   import org.apache.cocoon.woody.util.DomHelper;
   import org.apache.excalibur.source.Source;
   import org.apache.excalibur.source.SourceResolver;
  +import org.apache.excalibur.xml.sax.XMLizable;
   import org.xml.sax.InputSource;
   import org.xml.sax.SAXException;
   
  @@ -128,7 +129,7 @@
                   if (value == null)
                       throw new Exception("Could not convert the value \"" + stringValue
+ "\" to the type " + datatype.getDescriptiveName() + ", defined at " + DomHelper.getLocation(element));
   
  -                Object label = null;
  +                XMLizable label = null;
                   Element labelEl = DomHelper.getChildElement(element, Constants.WD_NS, "label");
                   if (labelEl != null) {
                       label = DomHelper.compileElementContent(labelEl);
  
  
  
  1.7       +6 -9      cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/datatype/StaticSelectionList.java
  
  Index: StaticSelectionList.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/datatype/StaticSelectionList.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- StaticSelectionList.java	20 Oct 2003 09:17:33 -0000	1.6
  +++ StaticSelectionList.java	13 Nov 2003 13:19:09 -0000	1.7
  @@ -55,8 +55,8 @@
   import org.apache.cocoon.woody.Constants;
   import org.apache.cocoon.woody.datatype.convertor.Convertor;
   import org.apache.cocoon.woody.datatype.convertor.DefaultFormatCache;
  -import org.apache.cocoon.components.sax.XMLByteStreamInterpreter;
   import org.apache.cocoon.xml.AttributesImpl;
  +import org.apache.excalibur.xml.sax.XMLizable;
   
   import java.util.List;
   import java.util.ArrayList;
  @@ -74,7 +74,6 @@
       /** The datatype to which this selection list belongs */
       private Datatype datatype;
       private List items = new ArrayList();
  -    private XMLByteStreamInterpreter interpreter = new XMLByteStreamInterpreter();
   
       public StaticSelectionList(Datatype datatype) {
           this.datatype = datatype;
  @@ -102,17 +101,17 @@
       /**
        * Adds a new item to this selection list.
        * @param value a value of the correct type (i.e. the type with which this selectionlist
is associated)
  -     * @param label a SAX-fragment created using the XMLByteStreamCompiler, can be null
  +     * @param label a SAX-fragment such as a {@link org.apache.cocoon.xml.SaxBuffer}, can
be null
        */
  -    public void addItem(Object value, Object label) {
  +    public void addItem(Object value, XMLizable label) {
           items.add(new SelectionListItem(value, label));
       }
   
       public final class SelectionListItem {
           private final Object value;
  -        private final Object label;
  +        private final XMLizable label;
   
  -        public SelectionListItem(Object value, Object label) {
  +        public SelectionListItem(Object value, XMLizable label) {
               this.value = value;
               this.label = label;
           }
  @@ -130,9 +129,7 @@
               contentHandler.startElement(Constants.WI_NS, ITEM_EL, Constants.WI_PREFIX_COLON
+ ITEM_EL, itemAttrs);
               contentHandler.startElement(Constants.WI_NS, LABEL_EL, Constants.WI_PREFIX_COLON
+ LABEL_EL, Constants.EMPTY_ATTRS);
               if (label != null) {
  -                interpreter.recycle();
  -                interpreter.setContentHandler(contentHandler);
  -                interpreter.deserialize(label);
  +                label.toSAX(contentHandler);
               } else {
                   contentHandler.characters(stringValue.toCharArray(), 0, stringValue.length());
               }
  
  
  
  1.4       +22 -80    cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/datatype/ValidationError.java
  
  Index: ValidationError.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/datatype/ValidationError.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ValidationError.java	28 Jul 2003 15:54:57 -0000	1.3
  +++ ValidationError.java	13 Nov 2003 13:19:09 -0000	1.4
  @@ -52,72 +52,56 @@
   
   import org.xml.sax.ContentHandler;
   import org.xml.sax.SAXException;
  -import org.apache.cocoon.components.sax.XMLByteStreamInterpreter;
  -import org.apache.cocoon.transformation.I18nTransformer;
  -import org.apache.cocoon.woody.Constants;
  -import org.apache.cocoon.xml.AttributesImpl;
  +import org.apache.cocoon.woody.util.I18nMessage;
  +import org.apache.cocoon.woody.util.StringMessage;
  +import org.apache.excalibur.xml.sax.XMLizable;
   
   /**
    * An object that holds a validation error message. The error message can
  - * be a simple string (which should be a message bundle key) or a piece of XML.
  + * be a simple string or a piece of XML.
    */
   public class ValidationError {
  -    /** Holds the error message compiled using the {@link org.apache.cocoon.components.sax.XMLByteStreamCompiler}.
*/
  -    private Object saxFragment;
  -    /** Holds a simple string error message. */
  -    private String errorMessage;
  -    /** Should the errorMessage be interpreted as a resource bundle key? */
  -    private boolean i18n;
  -    private String[] errorMessageParameters;
  -    private boolean[] keys;
  +    /** Holds the error message. */
  +    private XMLizable saxFragment;
   
       /**
        * @param i18n should the errorMessage be interpreted as an i18n key?
        */
       public ValidationError(String errorMessage, boolean i18n) {
  -        this.errorMessage = errorMessage;
  -        this.i18n = i18n;
  +        if (i18n)
  +            saxFragment = new I18nMessage(errorMessage);
  +        else
  +            saxFragment = new StringMessage(errorMessage);
       }
   
       /**
  -     * @param errorMessageKey a message key, to be translated by the I18nTransformer
  +     * @see I18nMessage#I18nMessage(java.lang.String)
        */
       public ValidationError(String errorMessageKey) {
  -        this.errorMessage = errorMessageKey;
  -        this.i18n = true;
  +        this.saxFragment = new I18nMessage(errorMessageKey);
       }
   
       /**
  -     * @param errorMessageKey a message key, to be translated by the I18nTransformer
  -     * @param parameters parameters to be substituted in the errorMessage (will be
  -     * done by the I18nTransformer)
  +     * @see I18nMessage#I18nMessage(java.lang.String, java.lang.String[])
        */
       public ValidationError(String errorMessageKey, String[] parameters) {
  -        this.errorMessage = errorMessageKey;
  -        this.errorMessageParameters = parameters;
  -        this.keys = null;
  -        this.i18n = true;
  +        this.saxFragment = new I18nMessage(errorMessageKey, parameters);
       }
   
       /**
  -     * @param errorMessageKey a message key, to be translated by the I18nTransformer
  -     * @param parameters parameters to be substituted in the errorMessage (will be
  -     * done by the I18nTransformer)
  -     * @param keys Each element in the keys array corresponds to a string in the parameters
array
  -     * and indicates whether that parameter is in itself again a key.
  +     * @see I18nMessage#I18nMessage(java.lang.String, java.lang.String[], boolean[])
        */
       public ValidationError(String errorMessageKey, String[] parameters, boolean[] keys)
{
  -        this.errorMessage = errorMessageKey;
  -        this.errorMessageParameters = parameters;
  -        this.keys = keys;
  -        this.i18n = true;
  +        this.saxFragment = new I18nMessage(errorMessageKey, parameters, keys);
       }
   
       /**
  -     * @param errorMessage the errormessages as precompiled XML produced by the
  -     *        {@link org.apache.cocoon.components.sax.XMLByteStreamCompiler XMLByteStreamCompiler}.
  +     * @param errorMessage the errormessages in the form of something that is "XMLizable",
  +     * i.e. can produce SAX events. It should however not produce start/endDocument calls,
  +     * only a piece of embeddable, stand-alone SAX events. Helpful implementations are
  +     * {@link org.apache.cocoon.xml.SaxBuffer SaxBuffer}, {@link I18nMessage} or {@link
StringMessage}.
        */
  -    public ValidationError(Object errorMessage) {
  +    public ValidationError(XMLizable errorMessage) {
           this.saxFragment = errorMessage;
       }
   
  @@ -127,49 +111,7 @@
        */
       public void generateSaxFragment(ContentHandler contentHandler) throws SAXException
{
           if (saxFragment != null) {
  -            XMLByteStreamInterpreter byteStreamInterpreter = new XMLByteStreamInterpreter();
  -            byteStreamInterpreter.setContentHandler(contentHandler);
  -            byteStreamInterpreter.deserialize(saxFragment);
  -        } else if (errorMessageParameters != null) {
  -            contentHandler.startPrefixMapping("i18n", I18nTransformer.I18N_NAMESPACE_URI);
  -
  -            contentHandler.startElement(I18nTransformer.I18N_NAMESPACE_URI, I18nTransformer.I18N_TRANSLATE_ELEMENT,
"i18n:" + I18nTransformer.I18N_TRANSLATE_ELEMENT, Constants.EMPTY_ATTRS);
  -
  -            // the i18n:text element
  -            AttributesImpl i18nAttrs = new AttributesImpl();
  -            i18nAttrs.addCDATAAttribute(I18nTransformer.I18N_NAMESPACE_URI, I18nTransformer.I18N_CATALOGUE_ATTRIBUTE,
"i18n:" + I18nTransformer.I18N_CATALOGUE_ATTRIBUTE, "woody");
  -
  -            contentHandler.startElement(I18nTransformer.I18N_NAMESPACE_URI, I18nTransformer.I18N_TEXT_ELEMENT,
"i18n:" + I18nTransformer.I18N_TEXT_ELEMENT, i18nAttrs);
  -            contentHandler.characters(errorMessage.toCharArray(), 0, errorMessage.length());
  -            contentHandler.endElement(I18nTransformer.I18N_NAMESPACE_URI, I18nTransformer.I18N_TEXT_ELEMENT,
"i18n:" + I18nTransformer.I18N_TEXT_ELEMENT);
  -
  -            // the parameters
  -            for (int i = 0; i < errorMessageParameters.length; i++) {
  -                contentHandler.startElement(I18nTransformer.I18N_NAMESPACE_URI, I18nTransformer.I18N_PARAM_ELEMENT,
"i18n:" + I18nTransformer.I18N_PARAM_ELEMENT, Constants.EMPTY_ATTRS);
  -                if (keys != null && keys[i])
  -                    contentHandler.startElement(I18nTransformer.I18N_NAMESPACE_URI, I18nTransformer.I18N_TEXT_ELEMENT,
"i18n:" + I18nTransformer.I18N_TEXT_ELEMENT, i18nAttrs);
  -                contentHandler.characters(errorMessageParameters[i].toCharArray(), 0, errorMessageParameters[i].length());
  -                if (keys != null && keys[i])
  -                    contentHandler.endElement(I18nTransformer.I18N_NAMESPACE_URI, I18nTransformer.I18N_TEXT_ELEMENT,
"i18n:" + I18nTransformer.I18N_TEXT_ELEMENT);
  -                contentHandler.endElement(I18nTransformer.I18N_NAMESPACE_URI, I18nTransformer.I18N_PARAM_ELEMENT,
"i18n:" + I18nTransformer.I18N_PARAM_ELEMENT);
  -            }
  -
  -            contentHandler.endElement(I18nTransformer.I18N_NAMESPACE_URI, I18nTransformer.I18N_TRANSLATE_ELEMENT,
"i18n:" + I18nTransformer.I18N_TRANSLATE_ELEMENT);
  -
  -            contentHandler.endPrefixMapping("i18n");
  -        } else if (i18n) {
  -            contentHandler.startPrefixMapping("i18n", I18nTransformer.I18N_NAMESPACE_URI);
  -
  -            AttributesImpl i18nAttrs = new AttributesImpl();
  -            i18nAttrs.addCDATAAttribute(I18nTransformer.I18N_NAMESPACE_URI, I18nTransformer.I18N_CATALOGUE_ATTRIBUTE,
"i18n:" + I18nTransformer.I18N_CATALOGUE_ATTRIBUTE, "woody");
  -
  -            contentHandler.startElement(I18nTransformer.I18N_NAMESPACE_URI, I18nTransformer.I18N_TEXT_ELEMENT,
"i18n:" + I18nTransformer.I18N_TEXT_ELEMENT, i18nAttrs);
  -            contentHandler.characters(errorMessage.toCharArray(), 0, errorMessage.length());
  -            contentHandler.endElement(I18nTransformer.I18N_NAMESPACE_URI, I18nTransformer.I18N_TEXT_ELEMENT,
"i18n:" + I18nTransformer.I18N_TEXT_ELEMENT);
  -
  -            contentHandler.endPrefixMapping("i18n");
  -        } else {
  -            contentHandler.characters(errorMessage.toCharArray(), 0, errorMessage.length());
  +            saxFragment.toSAX(contentHandler);
           }
       }
   }
  
  
  
  1.2       +4 -3      cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/datatype/validationruleimpl/AbstractValidationRule.java
  
  Index: AbstractValidationRule.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/datatype/validationruleimpl/AbstractValidationRule.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AbstractValidationRule.java	22 Apr 2003 12:04:19 -0000	1.1
  +++ AbstractValidationRule.java	13 Nov 2003 13:19:09 -0000	1.2
  @@ -53,6 +53,7 @@
   import org.apache.cocoon.woody.datatype.ValidationRule;
   import org.apache.cocoon.woody.datatype.ValidationError;
   import org.apache.cocoon.woody.formmodel.CannotYetResolveWarning;
  +import org.apache.excalibur.xml.sax.XMLizable;
   import org.outerj.expression.Expression;
   import org.outerj.expression.ExpressionContext;
   import org.outerj.expression.ExpressionException;
  @@ -64,16 +65,16 @@
    * implementations.
    */
   public abstract class AbstractValidationRule implements ValidationRule {
  -    private Object failMessage;
  +    private XMLizable failMessage;
   
       /**
        * Sets the failmessage to use for this validation rule, this will be used
        * instead of the validation rules' built-in message. The message itself should
  -     * be an object obtained from Cocoon's XMLByteStreamCompiler. This
  +     * be an object impementing XMLizable, such as a SaxBuffer instance. This
        * allows fail messages to contain mixed content (instead of just
        * being a string).
        */
  -    public void setFailMessage(Object object) {
  +    public void setFailMessage(XMLizable object) {
           this.failMessage = object;
       }
   
  
  
  
  1.3       +2 -1      cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/datatype/validationruleimpl/AbstractValidationRuleBuilder.java
  
  Index: AbstractValidationRuleBuilder.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/datatype/validationruleimpl/AbstractValidationRuleBuilder.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AbstractValidationRuleBuilder.java	16 Jul 2003 13:59:28 -0000	1.2
  +++ AbstractValidationRuleBuilder.java	13 Nov 2003 13:19:09 -0000	1.3
  @@ -59,6 +59,7 @@
   import org.apache.avalon.framework.service.Serviceable;
   import org.apache.avalon.framework.service.ServiceManager;
   import org.apache.avalon.framework.service.ServiceException;
  +import org.apache.excalibur.xml.sax.XMLizable;
   import org.w3c.dom.Element;
   import org.outerj.expression.Expression;
   import org.outerj.expression.TokenMgrError;
  @@ -82,7 +83,7 @@
       protected void buildFailMessage(Element validationRuleElement, AbstractValidationRule
rule) {
           Element failMessageElement = DomHelper.getChildElement(validationRuleElement, Constants.WD_NS,
"failmessage");
           if (failMessageElement != null) {
  -            Object failMessage = DomHelper.compileElementContent(failMessageElement);
  +            XMLizable failMessage = DomHelper.compileElementContent(failMessageElement);
               rule.setFailMessage(failMessage);
           }
       }
  
  
  
  1.3       +5 -13     cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/formmodel/AbstractWidgetDefinition.java
  
  Index: AbstractWidgetDefinition.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/formmodel/AbstractWidgetDefinition.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AbstractWidgetDefinition.java	24 Oct 2003 14:13:49 -0000	1.2
  +++ AbstractWidgetDefinition.java	13 Nov 2003 13:19:09 -0000	1.3
  @@ -55,15 +55,14 @@
   
   import org.xml.sax.ContentHandler;
   import org.xml.sax.SAXException;
  -import org.apache.cocoon.components.sax.XMLByteStreamInterpreter;
   import org.apache.cocoon.woody.Constants;
  +import org.apache.excalibur.xml.sax.XMLizable;
   
   /**
    * Provides functionality that is common across many WidgetDefinition implementations.
    */
   public abstract class AbstractWidgetDefinition implements WidgetDefinition {
       private String id;
  -//    private Object label;
       private Map displayData;
   
       public String getId() {
  @@ -80,7 +79,7 @@
   
       /**
        * Sets the various display data for this widget. This includes the label, hint and
help.
  -     * They're all SAX fragments generated with Cocoon's XMLByteStreamCompiler. This approach
  +     * They must all be objects implementing the XMLizable interface. This approach
        * allows to have mixed content in these data.
        * 
        * @param displayData an association of {name, sax fragment}
  @@ -92,18 +91,13 @@
       public void generateDisplayData(String name, ContentHandler contentHandler) throws
SAXException {
           Object data = this.displayData.get(name);
           if (data != null) {
  -            XMLByteStreamInterpreter interpreter = new XMLByteStreamInterpreter();
  -            interpreter.setContentHandler(contentHandler);
  -            interpreter.deserialize(data);
  -            
  +            ((XMLizable)data).toSAX(contentHandler);
           } else if (!this.displayData.containsKey(name)) {
               throw new IllegalArgumentException("Unknown display data name '" + name + "'");
           }
       }
       
       public void generateDisplayData(ContentHandler contentHandler) throws SAXException
{
  -        XMLByteStreamInterpreter interpreter = new XMLByteStreamInterpreter();
  -        
           // Output all non-null display data
           Iterator iter = this.displayData.entrySet().iterator();
           while (iter.hasNext()) {
  @@ -114,10 +108,8 @@
                   // Enclose the data into a "wi:{name}" element
                   contentHandler.startElement(Constants.WI_NS, name, Constants.WI_PREFIX_COLON
+ name, Constants.EMPTY_ATTRS);
   
  -                interpreter.setContentHandler(contentHandler);
  -                interpreter.deserialize(entry.getValue());
  -                interpreter.recycle();
  -                
  +                ((XMLizable)entry.getValue()).toSAX(contentHandler);
  +
                   contentHandler.endElement(Constants.WI_NS, name, Constants.WI_PREFIX_COLON
+ name);
               }
           }
  
  
  
  1.7       +2 -1      cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/formmodel/AbstractWidgetDefinitionBuilder.java
  
  Index: AbstractWidgetDefinitionBuilder.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/formmodel/AbstractWidgetDefinitionBuilder.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- AbstractWidgetDefinitionBuilder.java	24 Oct 2003 14:13:49 -0000	1.6
  +++ AbstractWidgetDefinitionBuilder.java	13 Nov 2003 13:19:09 -0000	1.7
  @@ -71,6 +71,7 @@
   import org.apache.avalon.framework.service.ServiceSelector;
   import org.apache.avalon.framework.CascadingException;
   import org.apache.avalon.framework.activity.Disposable;
  +import org.apache.excalibur.xml.sax.XMLizable;
   
   /**
    * Abstract base class for WidgetDefinitionBuilders. Provides functionality
  @@ -128,7 +129,7 @@
           final String[] names = {"label", "help", "hint"};
           Map displayData = new HashMap(names.length);
           for (int i = 0; i < names.length; i++) {
  -            Object data = null;
  +            XMLizable data = null;
               Element dataElement = DomHelper.getChildElement(widgetElement, Constants.WD_NS,
names[i]);
               if (dataElement != null) {
                   data = DomHelper.compileElementContent(dataElement);
  
  
  
  1.4       +4 -3      cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/formmodel/AggregateFieldDefinition.java
  
  Index: AggregateFieldDefinition.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/formmodel/AggregateFieldDefinition.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AggregateFieldDefinition.java	3 Jul 2003 11:36:10 -0000	1.3
  +++ AggregateFieldDefinition.java	13 Nov 2003 13:19:09 -0000	1.4
  @@ -53,6 +53,7 @@
   import org.outerj.expression.Expression;
   import org.apache.oro.text.regex.Pattern;
   import org.apache.cocoon.woody.datatype.ValidationRule;
  +import org.apache.excalibur.xml.sax.XMLizable;
   
   import java.util.List;
   import java.util.ArrayList;
  @@ -73,7 +74,7 @@
        * Message to be displayed when the {@link #splitPattern} does not match what the
        * user entered. Optional.
        */
  -    protected Object splitFailMessage;
  +    protected XMLizable splitFailMessage;
       /**
        * List containing instances of {@link #splitMappings}, i.e. the mapping between
        * a group (paren) from the regular expression and corresponding field id.
  @@ -123,11 +124,11 @@
           return splitRegexp;
       }
   
  -    public Object getSplitFailMessage() {
  +    public XMLizable getSplitFailMessage() {
           return splitFailMessage;
       }
   
  -    protected void setSplitFailMessage(Object splitFailMessage) {
  +    protected void setSplitFailMessage(XMLizable splitFailMessage) {
           this.splitFailMessage = splitFailMessage;
       }
   
  
  
  
  1.5       +2 -1      cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/formmodel/AggregateFieldDefinitionBuilder.java
  
  Index: AggregateFieldDefinitionBuilder.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/formmodel/AggregateFieldDefinitionBuilder.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- AggregateFieldDefinitionBuilder.java	2 Nov 2003 09:52:05 -0000	1.4
  +++ AggregateFieldDefinitionBuilder.java	13 Nov 2003 13:19:09 -0000	1.5
  @@ -57,6 +57,7 @@
   import org.apache.oro.text.regex.Perl5Compiler;
   import org.apache.oro.text.regex.Pattern;
   import org.apache.oro.text.regex.MalformedPatternException;
  +import org.apache.excalibur.xml.sax.XMLizable;
   import org.outerj.expression.Expression;
   
   import java.util.HashSet;
  @@ -110,7 +111,7 @@
           // read split fail message (if any)
           Element failMessageElement = DomHelper.getChildElement(splitElement, Constants.WD_NS,
"failmessage");
           if (failMessageElement != null) {
  -            Object failMessage = DomHelper.compileElementContent(failMessageElement);
  +            XMLizable failMessage = DomHelper.compileElementContent(failMessageElement);
               definition.setSplitFailMessage(failMessage);
           }
   
  
  
  
  1.9       +10 -7     cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/util/DomHelper.java
  
  Index: DomHelper.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/util/DomHelper.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- DomHelper.java	3 Nov 2003 17:05:32 -0000	1.8
  +++ DomHelper.java	13 Nov 2003 13:19:10 -0000	1.9
  @@ -53,8 +53,9 @@
   import org.apache.xerces.parsers.DOMParser;
   import org.apache.xerces.xni.*;
   import org.apache.xerces.dom.NodeImpl;
  -import org.apache.cocoon.components.sax.XMLByteStreamCompiler;
   import org.apache.cocoon.xml.dom.DOMStreamer;
  +import org.apache.cocoon.xml.SaxBuffer;
  +import org.apache.excalibur.xml.sax.XMLizable;
   import org.w3c.dom.*;
   import org.xml.sax.InputSource;
   import org.xml.sax.SAXNotSupportedException;
  @@ -256,13 +257,15 @@
       }
   
       /**
  -     * Uses Cocoon's XMLByteStreamCompiler to convert the content of the given element
to compiled
  -     * SAX events.
  +     * Returns the content of the given Element as an object implementing the XMLizable
  +     * interface. Practically speaking, the implementation uses the {@link SaxBuffer} class.
  +     * The XMLizable object will be a standalone blurb of SAX events, not producing
  +     * start/endDocument calls and containing all necessary namespace declarations.
        */
  -    public static Object compileElementContent(Element element) {
  -        XMLByteStreamCompiler byteStreamCompiler = new XMLByteStreamCompiler();
  +    public static XMLizable compileElementContent(Element element) {
  +        SaxBuffer saxBuffer = new SaxBuffer();
           DOMStreamer domStreamer = new DOMStreamer();
  -        domStreamer.setContentHandler(byteStreamCompiler);
  +        domStreamer.setContentHandler(saxBuffer);
   
           NodeList childNodes = element.getChildNodes();
           for (int i = 0; i < childNodes.getLength(); i++) {
  @@ -273,7 +276,7 @@
                   throw new RuntimeException("Error in DomHelper.compileElementContent: "
+ e.toString());
               }
           }
  -        return byteStreamCompiler.getSAXFragment();
  +        return saxBuffer;
       }
   
       /**
  
  
  

Mime
View raw message