Package com.volantis.mcs.dom

Examples of com.volantis.mcs.dom.Document


         *     </BLOCK>
         *   </card>
         * <wml>
         */

        Document document = domFactory.createDocument();
        Element wml = domFactory.createElement();
        Element card = domFactory.createElement();
        Element p1 = domFactory.createElement();
        Element dissectable = domFactory.createElement();
        Element p2 = domFactory.createElement();
        Text text = domFactory.createText();
        Element shardLinkGroup = domFactory.createElement();
        Element p3 = domFactory.createElement();
        Element shardLink1 = domFactory.createElement();
        Element a1 = domFactory.createElement();
        Text link1 = domFactory.createText();
        Element shardLinkConditional = domFactory.createElement();
        Element br = domFactory.createElement();
        Element shardLink2 = domFactory.createElement();
        Element a2 = domFactory.createElement();
        Text link2 = domFactory.createText();
               
        wml.setName("wml");
        card.setName("card");
        p1.setName("BLOCK");
        dissectable.setName(DissectionConstants.DISSECTABLE_CONTENTS_ELEMENT);
        p2.setName("BLOCK");
        text.append("some content");
        shardLinkGroup.setName(DissectionConstants.SHARD_LINK_GROUP_ELEMENT);
        p3.setName("BLOCK");
        p3.setAttribute("mode", "wrap");               
        shardLink1.setName(DissectionConstants.SHARD_LINK_ELEMENT);
        a1.setName("a");
        a1.setAttribute("href", "url1");
        a1.addTail(link1);
        link1.append("link1");
        shardLinkConditional.setName(
            DissectionConstants.SHARD_LINK_CONDITIONAL_ELEMENT);
        br.setName("br");                            
        shardLink2.setName(DissectionConstants.SHARD_LINK_ELEMENT);
        a2.setName("a");
        a2.setAttribute("href", "url2");
        a2.addTail(link2);
        link2.append("link2");
     
        document.addNode(wml);
        wml.addTail(card);
        card.addTail(p1);
        p1.addTail(dissectable);
        dissectable.addTail(p2);
        p2.addTail(text);
        p1.addTail(shardLinkGroup);
        shardLinkGroup.addTail(p3);       
        p3.addTail(shardLink1);
        shardLink1.addTail(a1);
        p3.addTail(shardLinkConditional);
        shardLinkConditional.addTail(br);
        p3.addTail(shardLink2);
        shardLink2.addTail(a2);
       
        String expected =
            "<wml>" +
              "<card>"+
                "<"+DissectionConstants.DISSECTABLE_CONTENTS_ELEMENT+">" +
                  "<p>" +
                    "some content" +
                  "</p>" +
                "</"+DissectionConstants.DISSECTABLE_CONTENTS_ELEMENT+">" +
                "<"+DissectionConstants.SHARD_LINK_GROUP_ELEMENT+">" +
                  "<p mode=\"wrap\">" +
                    "<"+DissectionConstants.SHARD_LINK_ELEMENT+">" +
                      "<a href=\"url1\">link1</a>" +
                    "</"+DissectionConstants.SHARD_LINK_ELEMENT+">" +
                    "<"+DissectionConstants.SHARD_LINK_CONDITIONAL_ELEMENT+">" +
                      "<br/>" +
                    "</"+DissectionConstants.SHARD_LINK_CONDITIONAL_ELEMENT+">" +
                    "<"+DissectionConstants.SHARD_LINK_ELEMENT+">" +
                      "<a href=\"url2\">link2</a>" +
                    "</"+DissectionConstants.SHARD_LINK_ELEMENT+">" +
                  "</p>" +
                "</"+DissectionConstants.SHARD_LINK_GROUP_ELEMENT+">" +
              "</card>"+
            "</wml>";
                           
        // Transform dom from original so we can check against expected
        Document transformed = transformer.transform(protocol, document);
        String domAsString = DOMUtilities.toString(transformed);
        assertEquals("Shard Link Group not on same level as dissecting pane",
                     expected, domAsString);       
    }
View Full Code Here


        String expectedString =
                "<block><prompt></prompt></block>";
        XMLReader reader = DOMUtilities.getReader();

        Document expectedDom = DOMUtilities.read(reader, expectedString);
        expectedString = DOMUtilities.toString(
                expectedDom, protocol.getCharacterEncoder());
        String actualString = DOMUtilities.toString(
                buffer.getRoot(), protocol.getCharacterEncoder());
View Full Code Here

                "<nomatch>Sorry I did not understand you</nomatch>" +
                "</menu>";

        XMLReader reader = DOMUtilities.getReader();

        Document expectedDom = DOMUtilities.read(reader, expected);
        String expectedDOMAsString =
                DOMUtilities.toString(
                        expectedDom, protocol.getCharacterEncoder());

        assertEquals("the processed DOM is not as expected.",
View Full Code Here

        protocol.setMarinerPageContext(context);
        WMLDOMTransformer transformer = new WMLDOMTransformer(
                protocol, honourAlign);
        XMLReader reader = DOMUtilities.getReader();

        Document originalDom = StyledDOMTester.createStyledDom(original);
//        Document originalDom = DOMUtilities.read(reader, original);
        Document expectedDom = DOMUtilities.read(reader, expected);

        // Transform dom from original so we can check against expected
        Document dom = transformer.transform(protocol, originalDom);

        String domAsString = DOMUtilities.toString(dom);
        String expectedDomAsString = DOMUtilities.toString(expectedDom);

        assertEquals(expectedDomAsString, domAsString);
View Full Code Here

        String actual = DOMUtilities.toString(
                buffer.getRoot(), protocol.getCharacterEncoder());

        String expected = "<choice next=\"http://www.volantis.com/index." +
                "jsp\" dtmf=\"9\">Website Index.</choice>";
        Document expectedDom = DOMUtilities.read(reader, expected);
        String expectedDOMAsString =
                DOMUtilities.toString(
                        expectedDom, protocol.getCharacterEncoder());

        assertEquals("the processed DOM is not as expected.",
View Full Code Here

        String actual = DOMUtilities.toString(
                buffer.getRoot(), protocol.getCharacterEncoder());

        String expected = "<var expr=\"'" + xfValue +
            "'\" name=\"" + xfName + "\"/>";
        Document expectedDom = DOMUtilities.read(reader, expected);
        String expectedDOMAsString =
                DOMUtilities.toString(
                        expectedDom, protocol.getCharacterEncoder());

        assertEquals("the processed DOM is not as expected.",
View Full Code Here

        while (iterator.hasNext()) {
            Values values = (Values) iterator.next();
            DOMProtocol protocol = createProtocol();


            Document dom = getStrictStyledDOMHelper().parse(values.original);
            Document expected = getStrictStyledDOMHelper().parse(values.expected);
            String domAsString;
            String expectedAsString;
            DOMTransformer transformer = new XHTMLBasicTransformer();

            // Useful debug output
View Full Code Here

                            "<br/>" +
                            "<table>" +
                                "<tr><td>cell2></td></tr>" +
                            "</table>";

        Document dom = getStrictStyledDOMHelper().parse(input);
        Element table = dom.getRootElement();

        Element flattenedTable = doFlattenTable(table, expected);
        assertNull(flattenedTable.getName());
    }
View Full Code Here

                                "<p>cell1</p>" +
                                "<br/>" +
                                "<table><tr><td>cell2></td></tr></table>" +
                            "</div>";

        Document dom = getStrictStyledDOMHelper().parse(input);
        Element table = dom.getRootElement();

        Styles tableStyles = generateTestColorStyles();
        table.setStyles(tableStyles);
        table.setAttribute("styleClass", "testClass");
View Full Code Here

                      "<div style=\"color: #777;\">Your msisdn <b>506984444</b></div>" +
                    "</div>" +
                  "</form>" +
                "</body>";

        Document dom = getStrictStyledDOMHelper().parse(input);

        Element body = dom.getRootElement();
        Element form = getChild(body);

        // Get the first-level div, first index. There is only one.
        Element div11 = getChild(form);
View Full Code Here

TOP

Related Classes of com.volantis.mcs.dom.Document

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.