Package com.sun.org.apache.xalan.internal.xsltc.runtime

Examples of com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet


    }

    private void doTransform() {
        try {
            final Class clazz = ObjectFactory.findProviderClass(_className, true);
            final AbstractTranslet translet = (AbstractTranslet)clazz.newInstance();
            translet.postInitialization();

            // Create a SAX parser and get the XMLReader object it uses
            final SAXParserFactory factory = SAXParserFactory.newInstance();
            try {
                factory.setFeature(Constants.NAMESPACE_FEATURE,true);
            }
            catch (Exception e) {
                factory.setNamespaceAware(true);
            }
            final SAXParser parser = factory.newSAXParser();
            final XMLReader reader = parser.getXMLReader();

            // Set the DOM's DOM builder as the XMLReader's SAX2 content handler
            XSLTCDTMManager dtmManager =
                (XSLTCDTMManager)XSLTCDTMManager.getDTMManagerClass()
                                                .newInstance();

            DTMWSFilter wsfilter;
            if (translet != null && translet instanceof StripFilter) {
                wsfilter = new DOMWSFilter(translet);
            } else {
                wsfilter = null;
            }

            final DOMEnhancedForDTM dom =
                   (DOMEnhancedForDTM)dtmManager.getDTM(
                            new SAXSource(reader, new InputSource(_fileName)),
                            false, wsfilter, true, false, translet.hasIdCall());

            dom.setDocumentURI(_fileName);
            translet.prepassDocument(dom);

            // Pass global parameters
            int n = _params.size();
            for (int i = 0; i < n; i++) {
                Parameter param = (Parameter) _params.elementAt(i);
                translet.addParameter(param._name, param._value);
            }

            // Transform the document
            TransletOutputHandlerFactory tohFactory =
                TransletOutputHandlerFactory.newInstance();
            tohFactory.setOutputType(TransletOutputHandlerFactory.STREAM);
            tohFactory.setEncoding(translet._encoding);
            tohFactory.setOutputMethod(translet._method);

            if (_iterations == -1) {
                translet.transform(dom, tohFactory.getSerializationHandler());
            }
            else if (_iterations > 0) {
                long mm = System.currentTimeMillis();
                for (int i = 0; i < _iterations; i++) {
                    translet.transform(dom,
                                       tohFactory.getSerializationHandler());
                }
                mm = System.currentTimeMillis() - mm;

                System.err.println("\n<!--");
View Full Code Here


     * our sort key vector.
     */
    private final Comparable stringValue(int level) {
        // Get value from our array if possible
        if (_scanned <= level) {
            AbstractTranslet translet = _settings.getTranslet();
            Locale[] locales = _settings.getLocales();
            String[] caseOrder = _settings.getCaseOrders();

            // Get value from DOM if accessed for the first time
            final String str = extractValueFromDOM(_dom, _node, level,
View Full Code Here

  }

    private final Double numericValue(int level) {
        // Get value from our vector if possible
        if (_scanned <= level) {
            AbstractTranslet translet = _settings.getTranslet();

            // Get value from DOM if accessed for the first time
            final String str = extractValueFromDOM(_dom, _node, level,
                                                   translet, _last);
            Double num;
View Full Code Here

    private void doTransform() {
        try {
            final Class clazz = ObjectFactory.findProviderClass(
                _className, ObjectFactory.findClassLoader(), true);
            final AbstractTranslet translet = (AbstractTranslet)clazz.newInstance();
            translet.postInitialization();

            // Create a SAX parser and get the XMLReader object it uses
            final SAXParserFactory factory = SAXParserFactory.newInstance();
            try {
                factory.setFeature(Constants.NAMESPACE_FEATURE,true);
            }
            catch (Exception e) {
                factory.setNamespaceAware(true);
            }
            final SAXParser parser = factory.newSAXParser();
            final XMLReader reader = parser.getXMLReader();

            // Set the DOM's DOM builder as the XMLReader's SAX2 content handler
            XSLTCDTMManager dtmManager =
                (XSLTCDTMManager)XSLTCDTMManager.getDTMManagerClass()
                                                .newInstance();

            DTMWSFilter wsfilter;
            if (translet != null && translet instanceof StripFilter) {
                wsfilter = new DOMWSFilter(translet);
            } else {
                wsfilter = null;
            }

            final DOMEnhancedForDTM dom =
                   (DOMEnhancedForDTM)dtmManager.getDTM(
                            new SAXSource(reader, new InputSource(_fileName)),
                            false, wsfilter, true, false, translet.hasIdCall());

            dom.setDocumentURI(_fileName);
            translet.prepassDocument(dom);

            // Pass global parameters
            int n = _params.size();
            for (int i = 0; i < n; i++) {
                Parameter param = (Parameter) _params.elementAt(i);
                translet.addParameter(param._name, param._value);
            }

            // Transform the document
            TransletOutputHandlerFactory tohFactory =
                TransletOutputHandlerFactory.newInstance();
            tohFactory.setOutputType(TransletOutputHandlerFactory.STREAM);
            tohFactory.setEncoding(translet._encoding);
            tohFactory.setOutputMethod(translet._method);

            if (_iterations == -1) {
                translet.transform(dom, tohFactory.getSerializationHandler());
            }
            else if (_iterations > 0) {
                long mm = System.currentTimeMillis();
                for (int i = 0; i < _iterations; i++) {
                    translet.transform(dom,
                                       tohFactory.getSerializationHandler());
                }
                mm = System.currentTimeMillis() - mm;

                System.err.println("\n<!--");
View Full Code Here

            if (_class == null) defineTransletClasses();

            // The translet needs to keep a reference to all its auxiliary
            // class to prevent the GC from collecting them
            AbstractTranslet translet = (AbstractTranslet) _class[_transletIndex].newInstance();
            translet.postInitialization();
            translet.setTemplates(this);
            if (_auxClasses != null) {
                translet.setAuxiliaryClasses(_auxClasses);
            }

            return translet;
        }
        catch (InstantiationException e) {
View Full Code Here

TOP

Related Classes of com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet

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.