Package com.volantis.mcs.dom

Examples of com.volantis.mcs.dom.Document


        p.setName("BLOCK");
        int[] columns = {1, 1};
        Element table = createTable(2, columns);
        p.addTail(table);

        Document doc = domFactory.createDocument();
        doc.addNode(p);

        transformer.fixTable(table);

         String expected =
                 "<BLOCK>r0, c0</BLOCK>" +
View Full Code Here


        p.addTail(table);

        // the expected table should contain the correct value for
        // the column attribute
        table.setAttribute("columns", "3");
        Document doc = domFactory.createDocument();
        doc.addNode(p);
        String expected = DOMUtilities.toString(doc);

        // add the duff column attribute value in the table to be fixed
        table.setAttribute("columns", "200");
View Full Code Here

        deviceMock = new InternalDeviceMock("deviceMock", expectations);

        populateEmulateEmphasisTags();

        initializeTransformer();
        Document orig = domFactory.createDocument();
        Element wml = generateTestWML();
        orig.addNode(wml);

        transformer.transformElement(wml);

        String expected =
                "<wml>" +
                    "<card title=\"the test title\">" +
                        "<BLOCK>" +
                            "<div>TITLEthe test titleTITLE</div>" +
                        "</BLOCK>" +
                        "<BLOCK align=\"center\">" +
                            "<div>**<a href=\"wtai://wp/mc;20405050606\">20405050606</a>**</div>" +
                            "<div>**<anchor href=\"wtai://wp/mc;20405050606\">20405050606</anchor>**</div>" +
                            "<div>BIGThis is big text.BIG</div>" +
                            "<div>BOLDThis is b text.BOLD</div>" +
                            "<div>EMThis is em text.EM</div>" +
                            "<div>ITALICThis is i text.ITALIC</div>" +
                            "<div>SMALLThis is small text.SMALL</div>" +
                            "<div>STRONGThis is strong text.STRONG</div>" +
                            "<div>_This is u text._</div>" +
                        "</BLOCK>" +
                    "</card>" +
                "</wml>";

        assertEquals(expected, DOMUtilities.toString(orig));

        // And again.
        deviceMock = new InternalDeviceMock("deviceMock", expectations);

        // test that prefixes on their own are correctly rendered
        expectEmphasisTag(DevicePolicyConstants.EMULATE_WML_BOLD_TAG, true,
                "BOLD", "BOLD", null);

        // test that an altTag on its own is correctly rendered
        expectEmphasisTag(DevicePolicyConstants.EMULATE_WML_EMPHASIZE_TAG, true,
                null, null, "div");

        // test that link highlighting without an alternate tag works correctly
        expectEmphasisTag(DevicePolicyConstants.EMULATE_WML_LINK_HIGHLIGHTING,
                true, "**", "**", null);

        // special case - test that card titles with prefixes but no altTag
        // are correctly rendered
        expectEmphasisTag(DevicePolicyConstants.EMULATE_WML_CARD_TITLE, true,
                "TITLE", "TITLE", null);

        populateEmulateEmphasisTags();

        initializeTransformer();

        orig = domFactory.createDocument();
        wml = generateTestWML();
        orig.addNode(wml);

        transformer.transformElement(wml);

        expected =
                "<wml>" +
                    "<card title=\"the test title\">" +
                        "<BLOCK>TITLEthe test titleTITLE</BLOCK>" +
                        "<BLOCK align=\"center\">" +
                            "**<a href=\"wtai://wp/mc;20405050606\">20405050606</a>**" +
                            "**<anchor href=\"wtai://wp/mc;20405050606\">20405050606</anchor>**" +
                            "<div>BIGThis is big text.BIG</div>" +
                            "BOLDThis is b text.BOLD" +
                            "<div>This is em text.</div>" +
                            "<div>ITALICThis is i text.ITALIC</div>" +
                            "<div>SMALLThis is small text.SMALL</div>" +
                            "<div>STRONGThis is strong text.STRONG</div>" +
                            "<div>_This is u text._</div>" +
                        "</BLOCK>" +
                    "</card>" +
                "</wml>";

        assertEquals(expected, DOMUtilities.toString(orig));

        // And again.
        deviceMock = new InternalDeviceMock("deviceMock", expectations);

        // test that prefixes on their own are correctly rendered
        expectEmphasisTag(DevicePolicyConstants.EMULATE_WML_BOLD_TAG, true,
                "BOLD", "BOLD", null);

        // test that an altTag on its own is correctly rendered
        expectEmphasisTag(DevicePolicyConstants.EMULATE_WML_EMPHASIZE_TAG, true,
                null, null, "div");

        // test that link highlighting without an alternate tag works correctly
        expectEmphasisTag(DevicePolicyConstants.EMULATE_WML_LINK_HIGHLIGHTING,
                true, "**", "**", null);

        // special case - test that card titles with an altTag but no prefixes
        // is correctly rendered
        expectEmphasisTag(DevicePolicyConstants.EMULATE_WML_CARD_TITLE, true,
                null, null, "div");

        populateEmulateEmphasisTags();

        initializeTransformer();

        orig = domFactory.createDocument();
        wml = generateTestWML();
        orig.addNode(wml);

        transformer.transformElement(wml);

        expected =
                "<wml>" +
View Full Code Here

         *     </DISSECTABLE-CONTENTS>
         *   </card>
         * <wml>
         */

        Document document = domFactory.createDocument();
        Element wml = domFactory.createElement();
        Element card = domFactory.createElement();
        Element dissectable = domFactory.createElement();
        Element dividehint = domFactory.createElement();
        Element p = domFactory.createElement();
        Text text = domFactory.createText();
       
        wml.setName("wml");
        card.setName("card");
        dissectable.setName(DissectionConstants.DISSECTABLE_CONTENTS_ELEMENT);
        dividehint.setName(DissectionConstants.DIVIDE_HINT_ELEMENT);
        p.setName("BLOCK");
        text.append("some content");
       
        document.addNode(wml);
        wml.addTail(card);
        card.addTail(dissectable);       
        dissectable.addTail(dividehint);
        dissectable.addTail(p);
        p.addTail(text);
       
        String expected =
            "<wml>" +
              "<card>"+
                "<"+DissectionConstants.DISSECTABLE_CONTENTS_ELEMENT+">" +
                  "<"+DissectionConstants.KEEPTOGETHER_ELEMENT+">" +
                    "<p>" +
                      "some content" +
                    "</p>" +
                  "</"+DissectionConstants.KEEPTOGETHER_ELEMENT+">" +
                "</"+DissectionConstants.DISSECTABLE_CONTENTS_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("Conversion dividehint to keeptogether failed",
                     expected, domAsString);
    }
View Full Code Here

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

        Document document = domFactory.createDocument();
        Element wml = domFactory.createElement();
        Element card = domFactory.createElement();
        Element p1 = domFactory.createElement();
        Element dissectable = domFactory.createElement();
        Element dividehint = domFactory.createElement();
        Text zero = domFactory.createText();
        Element p2 = domFactory.createElement();
        Text text = domFactory.createText();
       
        wml.setName("wml");
        card.setName("card");
        p1.setName("BLOCK");
        dissectable.setName(DissectionConstants.DISSECTABLE_CONTENTS_ELEMENT);
        dividehint.setName(DissectionConstants.DIVIDE_HINT_ELEMENT);
        zero.append("");
        p2.setName("BLOCK");
        text.append("some content");
       
        document.addNode(wml);
        wml.addTail(card);
        card.addTail(p1);
        p1.addTail(dissectable);       
        dissectable.addTail(dividehint);
        dissectable.addTail(zero);
        dissectable.addTail(p2);
        p2.addTail(text);
       
        String expected =
            "<wml>" +
              "<card>"+
                "<"+DissectionConstants.DISSECTABLE_CONTENTS_ELEMENT+">" +
                  "<"+DissectionConstants.KEEPTOGETHER_ELEMENT+">" +
                    "<p>" +
                      "some content" +
                    "</p>" +
                  "</"+DissectionConstants.KEEPTOGETHER_ELEMENT+">" +
                "</"+DissectionConstants.DISSECTABLE_CONTENTS_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("Conversion dividehint to keeptogether failed",
                     expected, domAsString);
    }
View Full Code Here

         *   </card>
         * <wml>
         * As there isn't a node following the DIVIDE-HINT we omit it.
         */

        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 dividehint = domFactory.createElement();
        Text zero = domFactory.createText();
       
        wml.setName("wml");
        card.setName("card");
        p1.setName("BLOCK");
        dissectable.setName(DissectionConstants.DISSECTABLE_CONTENTS_ELEMENT);
        p2.setName("BLOCK");
        text.append("some content");
        dividehint.setName(DissectionConstants.DIVIDE_HINT_ELEMENT);
        zero.append("");
       
        document.addNode(wml);
        wml.addTail(card);
        card.addTail(p1);
        p1.addTail(dissectable);       
        dissectable.addTail(p2);
        p2.addTail(text);       
        dissectable.addTail(dividehint);
        dissectable.addTail(zero);       
       
        String expected =
            "<wml>" +
              "<card>"+
                "<"+DissectionConstants.DISSECTABLE_CONTENTS_ELEMENT+">" +
                  "<p>" +
                     "some content" +
                  "</p>" +                 
                "</"+DissectionConstants.DISSECTABLE_CONTENTS_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("Conversion dividehint to keeptogether failed",
                     expected, domAsString);
    }
View Full Code Here

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

        Document document = domFactory.createDocument();
        Element wml = domFactory.createElement();
        Element card = domFactory.createElement();
        Element p1 = domFactory.createElement();
        Element dissectable = domFactory.createElement();
        Element dividehint1 = domFactory.createElement();
        Text zero1 = domFactory.createText();
        Element dividehint2 = domFactory.createElement();
        Text zero2 = domFactory.createText();
        Element p2 = domFactory.createElement();
        Text text = domFactory.createText();
       
        wml.setName("wml");
        card.setName("card");
        p1.setName("BLOCK");
        dissectable.setName(DissectionConstants.DISSECTABLE_CONTENTS_ELEMENT);
        dividehint1.setName(DissectionConstants.DIVIDE_HINT_ELEMENT);
        zero1.append("");
        dividehint2.setName(DissectionConstants.DIVIDE_HINT_ELEMENT);
        zero2.append("");
        p2.setName("BLOCK");
        text.append("some content");
       
        document.addNode(wml);
        wml.addTail(card);
        card.addTail(p1);
        p1.addTail(dissectable);       
        dissectable.addTail(dividehint1);
        dissectable.addTail(zero1);       
        dissectable.addTail(dividehint2);
        dissectable.addTail(zero2);       
        dissectable.addTail(p2);
        p2.addTail(text);       
       
        String expected =
            "<wml>" +
              "<card>"+
                "<"+DissectionConstants.DISSECTABLE_CONTENTS_ELEMENT+">" +
                  "<"+DissectionConstants.KEEPTOGETHER_ELEMENT+">" +
                    "<p>" +
                      "some content" +
                    "</p>" +
                  "</"+DissectionConstants.KEEPTOGETHER_ELEMENT+">" +
                "</"+DissectionConstants.DISSECTABLE_CONTENTS_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("Conversion dividehint to keeptogether failed",
                     expected, domAsString);
    }
View Full Code Here

        String expectedString =
                "<block><prompt><xml>{an expression}</xml></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

        buffer.initialise();

        protocol.openSpan(buffer, attributes);
        protocol.closeSpan(buffer, attributes);

        Document document = domFactory.createDocument();
        document.addNode(buffer.getRoot());

        document = protocol.getDOMTransformer().transform(protocol, document);

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

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

         *     </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();
        Element keeptogether1 = domFactory.createElement();
        Element p3 = domFactory.createElement();
        Element keeptogether2 = domFactory.createElement();
        Element p4 = domFactory.createElement();
        Text text = domFactory.createText();
       
        wml.setName("wml");
        card.setName("card");
        p1.setName("BLOCK");
        dissectable.setName(DissectionConstants.DISSECTABLE_CONTENTS_ELEMENT);
        p2.setName("BLOCK");
        keeptogether1.setName(DissectionConstants.KEEPTOGETHER_ELEMENT);
        p3.setName("BLOCK");
        keeptogether2.setName(DissectionConstants.DIVIDE_HINT_ELEMENT);
        p4.setName("BLOCK");
        text.append("some content");
       
        document.addNode(wml);
        wml.addTail(card);
        card.addTail(p1);
        p1.addTail(dissectable);
        dissectable.addTail(p2);
        p2.addTail(keeptogether1);
        keeptogether1.addTail(p3);       
        p3.addTail(keeptogether2);
        keeptogether2.addTail(p4);       
        p4.addTail(text);       
       
        String expected =
            "<wml>" +
              "<card>"+
                "<"+DissectionConstants.DISSECTABLE_CONTENTS_ELEMENT+">" +
                  "<"+DissectionConstants.KEEPTOGETHER_ELEMENT+">" +
                    "<"+DissectionConstants.KEEPTOGETHER_ELEMENT+">" +
                      "<p>" +
                        "some content" +
                      "</p>" +
                     "</"+DissectionConstants.KEEPTOGETHER_ELEMENT+">" +
                  "</"+DissectionConstants.KEEPTOGETHER_ELEMENT+">" +
                "</"+DissectionConstants.DISSECTABLE_CONTENTS_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("Promotion of keeptogether failed",
                     expected, domAsString);       
    }
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.