Package nokogiri.internals

Examples of nokogiri.internals.NokogiriXsltErrorListener


    }
   
    private void init(IRubyObject stylesheet, Document document) throws TransformerConfigurationException {
        this.stylesheet = stylesheet;  // either RubyString or RubyFile
        if (factory == null) factory = TransformerFactory.newInstance();
        NokogiriXsltErrorListener elistener = new NokogiriXsltErrorListener();
        factory.setErrorListener(elistener);
        sheet = factory.newTemplates(new DOMSource(document));
    }
View Full Code Here


    public IRubyObject transform(ThreadContext context, IRubyObject[] args) {
        Ruby runtime = context.getRuntime();

        argumentTypeCheck(runtime, args[0]);

        NokogiriXsltErrorListener elistener = new NokogiriXsltErrorListener();
        DOMSource domSource = new DOMSource(((XmlDocument) args[0]).getDocument());
        DOMResult result = null;
        String stringResult = null;
        try{
            result = tryXsltTransformation(context, args, domSource, elistener); // DOMResult
            if (result.getNode().getFirstChild() == null) {
                stringResult = retryXsltTransformation(context, args, domSource, elistener); // StreamResult
            }
        } catch(TransformerConfigurationException ex) {
            throw runtime.newRuntimeError(ex.getMessage());
        } catch(TransformerException ex) {
            throw runtime.newRuntimeError(ex.getMessage());
        } catch (IOException ex) {
            throw runtime.newRuntimeError(ex.getMessage());
        }

        switch (elistener.getErrorType()) {
            case ERROR:
            case FATAL:
                throw runtime.newRuntimeError(elistener.getErrorMessage());
            case WARNING:
            default:
                // no-op
        }
View Full Code Here

TOP

Related Classes of nokogiri.internals.NokogiriXsltErrorListener

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.