Package org.jasig.portal.xml

Examples of org.jasig.portal.xml.XmlUtilities


    protected void testXsltUpgrade(
            final Resource xslResource, final PortalDataKey dataKey,
            final Resource inputResource, final Resource expectedResultResource,
            final Resource xsdResource) throws Exception {

        final XmlUtilities xmlUtilities = new XmlUtilitiesImpl() {
            @Override
            public Templates getTemplates(Resource stylesheet) throws TransformerConfigurationException, IOException {
                final TransformerFactory transformerFactory = TransformerFactory.newInstance();
                return transformerFactory.newTemplates(new StreamSource(stylesheet.getInputStream()));
            }
        };
       
        final XsltDataUpgrader xsltDataUpgrader = new XsltDataUpgrader();
        xsltDataUpgrader.setPortalDataKey(dataKey);
        xsltDataUpgrader.setXslResource(xslResource);
        xsltDataUpgrader.setXmlUtilities(xmlUtilities);
        xsltDataUpgrader.afterPropertiesSet();
       
       
        //Create XmlEventReader (what the JaxbPortalDataHandlerService has)
        final XMLInputFactory xmlInputFactory = xmlUtilities.getXmlInputFactory();
        final XMLEventReader xmlEventReader = xmlInputFactory.createXMLEventReader(inputResource.getInputStream());
        final Node sourceNode = xmlUtilities.convertToDom(xmlEventReader);
        final DOMSource source = new DOMSource(sourceNode);
       
        final DOMResult result = new DOMResult();
        xsltDataUpgrader.upgradeData(source, result);
View Full Code Here

TOP

Related Classes of org.jasig.portal.xml.XmlUtilities

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.