You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by ge...@apache.org on 2002/02/20 06:25:23 UTC

cvs commit: jakarta-velocity-dvsl/src/java/org/apache/tools/dvsl DVSL.java DVSLTask.java Transformer.java

geirm       02/02/19 21:25:22

  Modified:    src/java/org/apache/tools/dvsl DVSL.java DVSLTask.java
                        Transformer.java
  Log:
  Added support for a validation switch.  I think this makes sense
  here...
  
  Revision  Changes    Path
  1.7       +17 -1     jakarta-velocity-dvsl/src/java/org/apache/tools/dvsl/DVSL.java
  
  Index: DVSL.java
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity-dvsl/src/java/org/apache/tools/dvsl/DVSL.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DVSL.java	10 Feb 2002 09:20:56 -0000	1.6
  +++ DVSL.java	20 Feb 2002 05:25:21 -0000	1.7
  @@ -109,6 +109,9 @@
   
       private TemplateHandler templateHandler = new TemplateHandler();
   
  +    boolean validate = false;
  +
  +
       public DVSL()
       {
           classLoader = DVSL.class.getClassLoader();
  @@ -143,6 +146,19 @@
       }
   
       /**
  +     * <p>
  +     *  Uses a validating parser on all input documents
  +     * </p>
  +     *
  +     * @param validate
  +     */
  +
  +    public void setValidatingParser( boolean vp )
  +    {
  +        validate = vp;
  +    }
  +
  +    /**
        *  <p>
        *  Specify a classloader for loading the Toolbox classes.  Setting to null
        *  resets to the default ClassLoader.
  @@ -364,7 +380,7 @@
            *  velocity engine
            */
   
  -        transformer = new Transformer( ve, templateHandler,  baseContext );
  +        transformer = new Transformer( ve, templateHandler,  baseContext, validate );
       }
   
       /**
  
  
  
  1.5       +21 -3     jakarta-velocity-dvsl/src/java/org/apache/tools/dvsl/DVSLTask.java
  
  Index: DVSLTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity-dvsl/src/java/org/apache/tools/dvsl/DVSLTask.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DVSLTask.java	10 Feb 2002 09:20:56 -0000	1.4
  +++ DVSLTask.java	20 Feb 2002 05:25:22 -0000	1.5
  @@ -147,6 +147,8 @@
       private String velConfigClass = null;
       private Map velConfigMap = null;
       private Vector velConfigAttr = new Vector();
  +
  +    private boolean validatingParser = false;
   
       //private String outputtype = null;  // later when output type is supported
   
  @@ -179,9 +181,11 @@
           }
   
           /*
  -         * make a DVSL
  +         * make a DVSL and set validation
            */
  -        dvsl = new DVSL();
  +        dvsl = new DVSL();
  +
  +        dvsl.setValidatingParser( validatingParser );
   
           /*
            *  Create a new Classloader for loading the Toolbox and the Velocity
  @@ -478,7 +482,21 @@
       public void setClasspathRef(Reference r)
       {
           createClasspath().setRefid(r);
  -    }
  +    }
  +
  +    /**
  +     *  Sets the flag to have DVSL use a validating parser for the
  +     *  input documents
  +     */
  +    public void setValidatingParser( boolean validating )
  +    {
  +        if ( validating == true )
  +        {
  +            log("Parser is validating.");
  +        }
  +
  +        validatingParser = validating;
  +    }
   
       /**
        * Processes the given input XML file and stores the result
  
  
  
  1.3       +3 -2      jakarta-velocity-dvsl/src/java/org/apache/tools/dvsl/Transformer.java
  
  Index: Transformer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity-dvsl/src/java/org/apache/tools/dvsl/Transformer.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Transformer.java	10 Jan 2002 14:02:26 -0000	1.2
  +++ Transformer.java	20 Feb 2002 05:25:22 -0000	1.3
  @@ -118,13 +118,14 @@
        *  The context is the callers context with all tools and 
        *  style drek.
        */
  -    public Transformer( VelocityEngine ve, TemplateHandler th, Context context )
  +    public Transformer( VelocityEngine ve, TemplateHandler th, Context context,
  +                        boolean validate )
       {
           this.ve = ve;
           this.baseContext = context;
           this.templateHandler = th;
   
  -        saxReader = new SAXReader();
  +        saxReader = new SAXReader( validate );
       }
   
       /**
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>