<commit_before><?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements.  See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License.  You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<document xmlns="http://maven.apache.org/XDOC/2.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven.apache.org/xsd/xdoc-2.0.xsd">
  <properties>
    <title>Download Commons Digester</title>
    <author email="<EMAIL>">Commons Documentation Team</author>
  </properties>
  <body>
    <section name="An overview of the Digester Plugins module.">
      <p>Provides an easy mechanism whereby new digestion rules 
can be added dynamically during a digestion.</p>

      <subsection name="Introduction">
        <p>Many applications have xml configuration files which are "extensible".
Some examples of this are:</p>
<ul>
<li>Apache log4j allows user-provided "Appender" classes to be specified in 
    its configuration file</li>
<li>Apache Avalon allows "components" of a user-specified class</li>
<li>Apache Ant allows custom tasks to be defined</li>
</ul>
<p>The Digester "plugins" module can be used to add this kind of functionality
to your own applications.
</p>
      </subsection>

      <subsection name="An Example">
        <p>Let's start off with an example.</p>
<p>
Given the following digester rules in the main "parsing" application:</p>
<source>
        Digester digester = new Digester();
        PluginRules rc = new PluginRules();
        digester.setRules(rc);

        digester.addObjectCreate("pipeline", Pipeline.class);

        digester.addCallMethod("pipeline/source", "setSource", 1);
        digester.addCallParam("pipeline/source", 0, "file");

        PluginCreateRule pcr = new PluginCreateRule(Transform.class);
        digester.addRule("pipeline/transform", pcr);
        digester.addSetNext("pipeline/transform", "setTransform");

        digester.addCallMethod("pipeline/destination", "setDest", 1);
        digester.addCallParam("pipeline/destination", 0, "file");

        digester.parse(filename);
</source>
<p>
the following input can be processed:
</p>
<source>
    &lt;pipeline&gt;
      &lt;source file="input.txt"/&gt;
      &lt;transform plugin-class="SubstituteTransform"&gt;
        &lt;from&gt;changeme&lt;/from&gt;
        &lt;to&gt;changed&lt;/to&gt;
      &lt;/transform&gt;
      &lt;destination file="output.txt"/&gt;
    &lt;/pipeline&gt;
</source>
<p>
Note that the "SubstituteTransform" class is not hard-wired into the
application, and also that this class is configuring itself from the
same configuration file.</p>
<p>
The user can specify any class they like here, and (provided that class follows
the plugins conventions) it can use any Digester functionality to process<commit_msg>just reformatted sample code<commit_after><?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements.  See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License.  You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<document xmlns="http://maven.apache.org/XDOC/2.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven.apache.org/xsd/xdoc-2.0.xsd">
  <properties>
    <title>Download Commons Digester</title>
    <author email="<EMAIL>">Commons Documentation Team</author>
  </properties>
  <body>
    <section name="An overview of the Digester Plugins module.">
      <p>Provides an easy mechanism whereby new digestion rules 
can be added dynamically during a digestion.</p>

      <subsection name="Introduction">
        <p>Many applications have xml configuration files which are "extensible".
Some examples of this are:</p>
<ul>
<li>Apache log4j allows user-provided "Appender" classes to be specified in 
    its configuration file</li>
<li>Apache Avalon allows "components" of a user-specified class</li>
<li>Apache Ant allows custom tasks to be defined</li>
</ul>
<p>The Digester "plugins" module can be used to add this kind of functionality
to your own applications.
</p>
      </subsection>

      <subsection name="An Example">
        <p>Let's start off with an example.</p>
<p>
Given the following digester rules in the main "parsing" application:</p>
<source>
        Digester digester = new Digester();
        PluginRules rc = new PluginRules();
        digester.setRules( rc );

        digester.addObjectCreate( "pipeline", Pipeline.class );

        digester.addCallMethod( "pipeline/source", "setSource", 1 );
        digester.addCallParam( "pipeline/source", 0, "file" );

        PluginCreateRule pcr = new PluginCreateRule( Transform.class );
        digester.addRule( "pipeline/transform", pcr );
        digester.addSetNext( "pipeline/transform", "setTransform" );

        digester.addCallMethod("pipeline/destination", "setDest", 1);
        digester.addCallParam("pipeline/destination", 0, "file");

        digester.parse( filename );
</source>
<p>
the following input can be processed:
</p>
<source>
    &lt;pipeline&gt;
      &lt;source file="input.txt"/&gt;
      &lt;transform plugin-class="SubstituteTransform"&gt;
        &lt;from&gt;changeme&lt;/from&gt;
        &lt;to&gt;changed&lt;/to&gt;
      &lt;/transform&gt;
      &lt;destination file="output.txt"/&gt;
    &lt;/pipeline&gt;
</source>
<p>
Note that the "SubstituteTransform" class is not hard-wired into the
application, and also that this class is configuring itself from the
same configuration file.</p>
<p>
The user can specify any class they like here, and (provided that class follows
the plugins conventions) it can use any Digester functionality to process
{'fraction_non_alphanumeric': 0.11083708109676484, 'fraction_numerical': 0.006673436819962281, 'mean_word_length': 4.002902757619739, 'pattern_counts': {'":': 0, '<': 87, '<?xml version=': 2, '>': 87, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 8}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4128930', 'n_tokens_mistral': 2023, 'n_tokens_neox': 1947, 'n_words': 700}