<commit_before>package com.thaiopensource.relaxng.jarv;

import com.thaiopensource.relaxng.XMLReaderCreator;
import com.thaiopensource.relaxng.IncorrectSchemaException;
import com.thaiopensource.relaxng.parse.Parseable;
import com.thaiopensource.relaxng.parse.sax.SAXParseable;
import com.thaiopensource.relaxng.impl.Pattern;
import com.thaiopensource.relaxng.impl.SchemaPatternBuilder;
import com.thaiopensource.relaxng.impl.SchemaBuilderImpl;
import com.thaiopensource.relaxng.util.DraconianErrorHandler;
import com.thaiopensource.relaxng.util.Jaxp11XMLReaderCreator;
import org.iso_relax.verifier.Schema;
import org.iso_relax.verifier.VerifierFactory;
import org.relaxng.datatype.DatatypeLibraryFactory;
import org.relaxng.datatype.helpers.DatatypeLibraryLoader;
import org.xml.sax.ErrorHandler;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;

import java.io.IOException;

public class VerifierFactoryImpl extends VerifierFactory {
  private final XMLReaderCreator xrc = new Jaxp11XMLReaderCreator();
  private final DatatypeLibraryFactory dlf = new DatatypeLibraryLoader();
  private final ErrorHandler eh = new DraconianErrorHandler();

  public VerifierFactoryImpl() { }

  public Schema compileSchema(InputSource is) throws SAXException, IOException {
    SchemaPatternBuilder spb = new SchemaPatternBuilder();
    Parseable parseable = new SAXParseable(xrc, is, eh);
    try {
      return new SchemaImpl(SchemaBuilderImpl.parse(parseable, eh, dlf, spb), spb);
    }
    catch (IncorrectSchemaException e) {
      throw new SAXException("unreported schema error");
    }
  }
}<commit_msg>Allow schemaType to be specified. More sophisticated handling of attribute schemas<commit_after>package com.thaiopensource.relaxng.jarv;

import com.thaiopensource.relaxng.XMLReaderCreator;
import com.thaiopensource.relaxng.IncorrectSchemaException;
import com.thaiopensource.relaxng.parse.Parseable;
import com.thaiopensource.relaxng.parse.sax.SAXParseable;
import com.thaiopensource.relaxng.impl.Pattern;
import com.thaiopensource.relaxng.impl.SchemaPatternBuilder;
import com.thaiopensource.relaxng.impl.SchemaBuilderImpl;
import com.thaiopensource.relaxng.util.DraconianErrorHandler;
import com.thaiopensource.relaxng.util.Jaxp11XMLReaderCreator;
import org.iso_relax.verifier.Schema;
import org.iso_relax.verifier.VerifierFactory;
import org.relaxng.datatype.DatatypeLibraryFactory;
import org.relaxng.datatype.helpers.DatatypeLibraryLoader;
import org.xml.sax.ErrorHandler;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;

import java.io.IOException;

public class VerifierFactoryImpl extends VerifierFactory {
  private final XMLReaderCreator xrc = new Jaxp11XMLReaderCreator();
  private final DatatypeLibraryFactory dlf = new DatatypeLibraryLoader();
  private final ErrorHandler eh = new DraconianErrorHandler();

  public VerifierFactoryImpl() { }

  public Schema compileSchema(InputSource is) throws SAXException, IOException {
    SchemaPatternBuilder spb = new SchemaPatternBuilder();
    Parseable parseable = new SAXParseable(xrc, is, eh);
    try {
      return new SchemaImpl(SchemaBuilderImpl.parse(parseable, eh, dlf, spb, false), spb);
    }
    catch (IncorrectSchemaException e) {
      throw new SAXException("unreported schema error");
    }
  }
}
{'fraction_non_alphanumeric': 0.08442330558858502, 'fraction_numerical': 0.0023781212841854932, 'mean_word_length': 6.144373673036093, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 8}, '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': '6959149', 'n_tokens_mistral': 1064, 'n_tokens_neox': 1020, 'n_words': 203}