if(xpathObj instanceof XPathEvaluator){ XPathEvaluator xpe = (XPathEvaluator)xpathObj; xpe.getConfiguration().setVersionWarning(false); ((StandardErrorListener)xpe.getConfiguration().getErrorListener()).setRecoveryPolicy(Configuration.RECOVER_SILENTLY); xpe.getStaticContext().setBackwardsCompatibilityMode(true);
public Engine() throws Exception { String s = System.getProperty("te.cacheSize"); if (s != null) { cacheSize = Integer.parseInt(s); } // Create processor processor = new Processor(false); // Modify its configuration settings Configuration config = processor.getUnderlyingConfiguration(); config.setVersionWarning(false); // Use our custom error listener which reports line numbers in the CTL // source file errorListener = new TeErrorListener(); config.setErrorListener(errorListener); // Create a compiler and document builder compiler = processor.newXsltCompiler(); builder = processor.newDocumentBuilder(); // Load an executable for the TECore.form method ClassLoader cl = Thread.currentThread().getContextClassLoader(); InputStream is = cl.getResourceAsStream("com/occamlab/te/formfn.xsl"); formExecutable = compiler.compile(new StreamSource(is)); // Fortify Mod: We are done with the InputStream. Release the resource is.close(); }
public Engine() throws Exception { String s = System.getProperty("te.cacheSize"); if (s != null) { cacheSize = Integer.parseInt(s); } // Create processor processor = new Processor(false); // Modify its configuration settings Configuration config = processor.getUnderlyingConfiguration(); config.setVersionWarning(false); // Use our custom error listener which reports line numbers in the CTL // source file errorListener = new TeErrorListener(); config.setErrorListener(errorListener); // Create a compiler and document builder compiler = processor.newXsltCompiler(); builder = processor.newDocumentBuilder(); // Load an executable for the TECore.form method ClassLoader cl = Thread.currentThread().getContextClassLoader(); InputStream is = cl.getResourceAsStream("com/occamlab/te/formfn.xsl"); formExecutable = compiler.compile(new StreamSource(is)); // Fortify Mod: We are done with the InputStream. Release the resource is.close(); }
throw new IllegalArgumentException("VERSION_WARNING must be a boolean"); setVersionWarning(((Boolean)value).booleanValue());
public XsltService() { this.configuration = new Configuration(); this.configuration.setLineNumbering( true ); this.configuration.setHostLanguage( Configuration.XSLT ); this.configuration.setVersionWarning( false ); this.configuration.setCompileWithTracing( true ); this.configuration.setValidationWarnings( true ); }
@Override public List<Object> evaluate(TestCase testCase, String file) throws Exception{ XPathFactoryImpl xpf = new XPathFactoryImpl(); XPathEvaluator xpe = (XPathEvaluator)xpf.newXPath(); xpe.getConfiguration().setVersionWarning(false); ((StandardErrorListener)xpe.getConfiguration().getErrorListener()).setRecoveryPolicy(Configuration.RECOVER_SILENTLY); xpe.getStaticContext().setBackwardsCompatibilityMode(true); xpe.setXPathVariableResolver(testCase.variableResolver); xpe.setXPathFunctionResolver(testCase.functionResolver); xpe.setNamespaceContext(testCase.nsContext); NodeInfo doc = xpe.getConfiguration().buildDocument(new SAXSource(new InputSource(file))); List<Object> results = new ArrayList<Object>(testCase.xpaths.size()); for(XPathInfo xpathInfo: testCase.xpaths){ if(xpathInfo.forEach==null) results.add(xpe.evaluate(xpathInfo.xpath, doc, xpathInfo.resultType)); else{ List<Object> list = new ArrayList<Object>(); List nodeList = (List)xpe.evaluate(xpathInfo.forEach, doc, XPathConstants.NODESET); for(Object context: nodeList) list.add(xpe.evaluate(xpathInfo.xpath, context, xpathInfo.resultType)); results.add(list); } } return results; }
setVersionWarning(requireBoolean("VERSION_WARNING", value));
config.setVersionWarning(true); // unless suppressed by command line options schemaAware = config.isSchemaAware(Configuration.XSLT);
setVersionWarning(requireBoolean(name, value)); break;
setVersionWarning(requireBoolean(name, value)); break;