Package org.jasig.portal.xml

Examples of org.jasig.portal.xml.XmlUtilitiesImpl


    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


   
    @Test
    public void testDom4jRoundTripWithComment() throws Exception {
        final TestDom4jImporter importer = new TestDom4jImporter();
        final TestDom4jExporter exporter = new TestDom4jExporter();
        exporter.setXmlUtilities(new XmlUtilitiesImpl());
       
        final XMLInputFactory xmlInputFactory = XMLInputFactory.newInstance();
        final InputStream resource = this.getClass().getResourceAsStream("/org/jasig/portal/io/xml/crn/pilot-lo.fragment-layout.xml");
        final XMLEventReader xmlEventReader = xmlInputFactory.createXMLEventReader(resource);
        final Tuple<String, Element> result = importer.unmarshal(new StAXSource(xmlEventReader));
View Full Code Here

   
    @Test
    public void testDom4jCommentFiltering() throws Exception {
        final TestDom4jImporter importer = new TestDom4jImporter();
        final TestDom4jExporter exporter = new TestDom4jExporter();
        exporter.setXmlUtilities(new XmlUtilitiesImpl());
       
        final XMLInputFactory xmlInputFactory = XMLInputFactory.newInstance();
        final InputStream resource = this.getClass().getResourceAsStream("/org/jasig/portal/io/xml/crn/pilot-lo.fragment-layout.xml");
        final XMLEventReader xmlEventReader = xmlInputFactory.createXMLEventReader(resource);
        final Tuple<String, Element> result = importer.unmarshal(new StAXSource(xmlEventReader));
View Full Code Here

    public TemporaryFolder tempFolder = new TemporaryFolder();

   
    @Before
    public void setup() throws Exception {
        xmlUtilities = new XmlUtilitiesImpl() {
            @Override
            public Templates getTemplates(Resource stylesheet) throws TransformerConfigurationException, IOException {
                final TransformerFactory transformerFactory = TransformerFactory.newInstance();
                return transformerFactory.newTemplates(new StreamSource(stylesheet.getInputStream()));
            }
View Full Code Here

TOP

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

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.