<commit_before>package org.apache.cocoon.transformation;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Stack;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.apache.avalon.framework.parameters.Parameters;
import org.apache.cocoon.ProcessingException;
import org.apache.cocoon.components.modules.input.InputModuleHelper;
import org.apache.cocoon.environment.SourceResolver;
import org.apache.cocoon.transformation.helpers.TextRecorder;
import org.apache.cocoon.xml.SaxBuffer;
import org.apache.cocoon.xml.XMLUtils;
import org.apache.excalibur.xml.sax.XMLizable;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;

/**
 * This variation on the AbstractSAXTransformer modifies the sendXYZ methods,
 * so that they send to the next component in the pipeline.
 * Contrary to what you would expect, that is not what the AbstractSAXTransformer does.
 * It also fixes the broken behaviour of TextRecording, SerializedXMLRecording and SAXRecording.
 */
public class AbstractSAXPipelineTransformer extends AbstractSAXTransformer {

  /**
   * The namespaces and their prefixes
   */
  private final List<String[]> namespaces = new ArrayList<String[]>(10);
  
  /**
   * The current prefix for our namespace.
   */
  private String ourPrefix;
  
  private Stack<List<String>> prefixStack = new Stack<List<String>>();
  
  /**
   * Are we recording SAX events?
   */
  private boolean recordingSAX;

  /**
   * @see org.apache.cocoon.transformation.AbstractSAXTransformer#setup(org.apache.cocoon.environment.SourceResolver, java.util.Map, java.lang.String, org.apache.avalon.framework.parameters.Parameters)
   */
  @Override
  public void setup(SourceResolver resolver, Map objectModel, String src, Parameters params) throws ProcessingException, SAXException, IOException {
    super.setup(resolver, objectModel, src, params);
    this.ourPrefix = null;
    this.namespaces.clear();<commit_msg>Standaard namespace-prefix xml: definieren, want hoeft niet in het document zelf gedefinieerd te worden.<commit_after>package org.apache.cocoon.transformation;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Stack;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.apache.avalon.framework.parameters.Parameters;
import org.apache.cocoon.ProcessingException;
import org.apache.cocoon.components.modules.input.InputModuleHelper;
import org.apache.cocoon.environment.SourceResolver;
import org.apache.cocoon.transformation.helpers.TextRecorder;
import org.apache.cocoon.xml.SaxBuffer;
import org.apache.cocoon.xml.XMLUtils;
import org.apache.excalibur.xml.sax.XMLizable;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;

/**
 * This variation on the AbstractSAXTransformer modifies the sendXYZ methods,
 * so that they send to the next component in the pipeline.
 * Contrary to what you would expect, that is not what the AbstractSAXTransformer does.
 * It also fixes the broken behaviour of TextRecording, SerializedXMLRecording and SAXRecording.
 */
public class AbstractSAXPipelineTransformer extends AbstractSAXTransformer {

  /**
   * The namespaces and their prefixes
   */
  private final List<String[]> namespaces = new ArrayList<String[]>(10);
  
  /**
   * The current prefix for our namespace.
   */
  private String ourPrefix;
  
  private Stack<List<String>> prefixStack = new Stack<List<String>>();
  
  /**
   * Are we recording SAX events?
   */
  private boolean recordingSAX;

  /**
   * @see org.apache.cocoon.transformation.AbstractSAXTransformer#setup(org.apache.cocoon.environment.SourceResolver, java.util.Map, java.lang.String, org.apache.avalon.framework.parameters.Parameters)
   */
  @Override
  public void setup(SourceResolver resolver, Map objectModel, String src, Parameters params) throws ProcessingException, SAXException, IOException {
    super.setup(resolver, objectModel, src, params);
    this.ourPrefix = null;
    this.namespaces.clear();
    this.namespaces.add(new String[]{"xml", "http://www.w3.org/XML/1998/namespace"});
{'fraction_non_alphanumeric': 0.10137818266760103, 'fraction_numerical': 0.002102312543798178, 'mean_word_length': 4.914364640883978, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, 'xml': 12}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3438166', 'n_tokens_mistral': 1275, 'n_tokens_neox': 1242, 'n_words': 313}