Commit f7b44d94 authored by Fabien Triolet's avatar Fabien Triolet
Browse files

Added a validation parameter.

parent fc16c962
/*
* $Id: ReadFile.java,v 1.4 2003-02-06 08:36:42 triolet Exp $
* $Id: ReadFile.java,v 1.5 2003-04-09 13:54:43 triolet Exp $
*
* Transmorpher
*
......@@ -38,6 +38,10 @@ import java.io.IOException;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import org.xml.sax.ErrorHandler;
/**
* This class provide a basic process which is
......@@ -64,11 +68,19 @@ public final class ReadFile extends TReader {
public ReadFile(String[] pOut, Parameters pParam, StringParameters pStaticAttributes) throws SAXException, IOException {
super(pOut, pParam, pStaticAttributes);
try {
SAXParserFactory parserFactory = SAXParserFactory.newInstance();
parserFactory.setFeature(NAMESPACES_FEATURE_ID, DEFAULT_NAMESPACES);
parserFactory.setFeature(NAMESPACES_PREFIXES_FEATURE_ID, DEFAULT_NAMESPACES_PREFIXES);
parserFactory.setFeature(VALIDATION_FEATURE_ID, DEFAULT_VALIDATION);
if (((String)getParameter("validation"))!=null){
if (((String)getParameter("validation")).equals("true")){
parserFactory.setFeature(VALIDATION_FEATURE_ID, true);
}
else
parserFactory.setFeature(VALIDATION_FEATURE_ID, DEFAULT_VALIDATION);
}
/* parserFactory.setFeature(VALIDATION_FEATURE_ID, DEFAULT_VALIDATION); */
parserFactory.setFeature(SCHEMA_VALIDATION_FEATURE_ID, DEFAULT_SCHEMA_VALIDATION);
iReader = (parserFactory.newSAXParser()).getXMLReader();
} catch (Exception e) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment