Package org.apache.commons.jelly.parser

Examples of org.apache.commons.jelly.parser.XMLParser


   
    /**
     * Compiles the script
     */
    public Script compileScript() throws Exception {
        XMLParser parser = new XMLParser();
        parser.setContext(getJellyContext());
        Script script = parser.parse(getUrl().openStream());
        script = script.compile();
        if (log.isDebugEnabled()) {
            log.debug("Compiled script: " + getUrl());
        }
        return script;
View Full Code Here


    /**
     * Compile the script
     */
    private void compileScriptAndKeep() {
        XMLParser parser = new XMLParser();
        parser.setContext(m_context);
        try {
            m_script = parser.parse(m_inputStream);
            m_script = m_script.compile();
            m_scriptCompiled = true;
        }
        catch (IOException e) {
            m_scriptCompilationException = e;
View Full Code Here

    /**
     * Attempts to parse the script from the given uri using the
     * {@link #getResource} method then returns the compiled script.
     */
    public Script compileScript(String uri) throws JellyException {
        XMLParser parser = getXMLParser();
        parser.setContext(this);
        InputStream in = getResourceAsStream(uri);
        if (in == null) {
            throw new JellyException("Could not find Jelly script: " + uri);
        }
        Script script = null;
        try {
            script = parser.parse(in);
        } catch (IOException e) {
            throw new JellyException(JellyContext.BAD_PARSE, e);
        } catch (SAXException e) {
            throw new JellyException(JellyContext.BAD_PARSE, e);
        }
View Full Code Here

    /**
     * Attempts to parse the script from the given URL using the
     * {@link #getResource} method then returns the compiled script.
     */
    public Script compileScript(URL url) throws JellyException {
        XMLParser parser = getXMLParser();
        parser.setContext(this);

        Script script = null;
        try {
            script = parser.parse(url.toString());
        } catch (IOException e) {
            throw new JellyException(JellyContext.BAD_PARSE, e);
        } catch (SAXException e) {
            throw new JellyException(JellyContext.BAD_PARSE, e);
        }
View Full Code Here

    /**
     * Attempts to parse the script from the given InputSource using the
     * {@link #getResource} method then returns the compiled script.
     */
    public Script compileScript(InputSource source) throws JellyException {
        XMLParser parser = getXMLParser();
        parser.setContext(this);

        Script script = null;
        try {
            script = parser.parse(source);
        } catch (IOException e) {
            throw new JellyException(JellyContext.BAD_PARSE, e);
        } catch (SAXException e) {
            throw new JellyException(JellyContext.BAD_PARSE, e);
        }
View Full Code Here

    /**
     * @return a thread pooled XMLParser to avoid the startup overhead
     * of the XMLParser
     */
    protected XMLParser getXMLParser() {
        XMLParser parser = createXMLParser();
        return parser;
    }
View Full Code Here

    /**
     * Factory method to allow JellyContext implementations to overload how an XMLParser
     * is created - such as to overload what the default ExpressionFactory should be.
     */
    protected XMLParser createXMLParser() {
        return new XMLParser();
    }
View Full Code Here

        if (! loadedProperties) {
            loadedProperties = true;
            loadJellyProperties();
        }
       
        XMLParser parser = new XMLParser();
        try {
            parser.setContext(getJellyContext());
        } catch (MalformedURLException e) {
            throw new JellyException(e.toString());
        }
       
        Script script = null;
        try {
            parser.setDefaultNamespaceURI(this.defaultNamespaceURI);
            parser.setValidating(this.validateXML);
            script = parser.parse(getUrl());
            script = script.compile();
            if (log.isDebugEnabled()) {
               log.debug("Compiled script: " + getUrl());
            }
        } catch (IOException e) {
View Full Code Here

    /**
     * Compile the script
     */
    private void compileScriptAndKeep() {
        XMLParser parser = new XMLParser();
        parser.setContext(m_context);
        m_scriptCompiled = false;
        try {
            m_script = parser.parse(m_inputStream);
            m_script = m_script.compile();
            m_scriptCompiled = true;
        }
        catch (IOException e) {
            m_scriptCompilationException = e;
View Full Code Here

    /**
     * Factory method to create a new Jelly parser
     * @return XMLParser
     */
    protected XMLParser createJellyParser() {
        XMLParser answer = new XMLParser();
        answer.setContext(context);
        return answer;
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.jelly.parser.XMLParser

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.