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 * Transmorpher
* *
...@@ -38,6 +38,10 @@ import java.io.IOException; ...@@ -38,6 +38,10 @@ import java.io.IOException;
import javax.xml.parsers.SAXParserFactory; import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import org.xml.sax.ErrorHandler;
/** /**
* This class provide a basic process which is * This class provide a basic process which is
...@@ -64,11 +68,19 @@ public final class ReadFile extends TReader { ...@@ -64,11 +68,19 @@ public final class ReadFile extends TReader {
public ReadFile(String[] pOut, Parameters pParam, StringParameters pStaticAttributes) throws SAXException, IOException { public ReadFile(String[] pOut, Parameters pParam, StringParameters pStaticAttributes) throws SAXException, IOException {
super(pOut, pParam, pStaticAttributes); super(pOut, pParam, pStaticAttributes);
try { try {
SAXParserFactory parserFactory = SAXParserFactory.newInstance(); SAXParserFactory parserFactory = SAXParserFactory.newInstance();
parserFactory.setFeature(NAMESPACES_FEATURE_ID, DEFAULT_NAMESPACES); parserFactory.setFeature(NAMESPACES_FEATURE_ID, DEFAULT_NAMESPACES);
parserFactory.setFeature(NAMESPACES_PREFIXES_FEATURE_ID, DEFAULT_NAMESPACES_PREFIXES); 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); parserFactory.setFeature(SCHEMA_VALIDATION_FEATURE_ID, DEFAULT_SCHEMA_VALIDATION);
iReader = (parserFactory.newSAXParser()).getXMLReader(); iReader = (parserFactory.newSAXParser()).getXMLReader();
} catch (Exception e) { } 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