Package com.volantis.mcs.dom

Examples of com.volantis.mcs.dom.Document


    protected void checkDoProtocolString(
            DOMProtocol protocol, String expectedProtocolString)
            throws IOException {

        Document document = domFactory.createDocument();
        protocol.writeProtocolString(document);

        StringWriter writer = new StringWriter();
        DocumentWriter documentWriter = new XMLDocumentWriter(writer);

        XMLDeclaration declaration = document.getDeclaration();
        if (declaration != null) {
            documentWriter.outputXMLDeclaration(declaration);
        }

        DocType docType = document.getDocType();
        if (docType != null) {
            documentWriter.outputDocType(docType);
        }

        assertEquals("Protocol string should match",
View Full Code Here


     * @param buffer the DOMOutputBuffer
     * @return a string representation of the DOMOutputBuffer
     */
    protected String bufferToString(DOMOutputBuffer buffer) {
        String result = null;
        Document doc = domFactory.createDocument();
        doc.addNode(buffer.getRoot());
        try {
            result = DOMUtilities.toString(doc, protocol.getCharacterEncoder());
            //System.out.println("buffer = " + result);
        } catch (Exception e) {
            // @todo change this to throw Exception and change all it's clients
View Full Code Here

     * @throws Exception if there was a problem.
     */
    private void checkRemoveInnerDivTag(String input, String expected)
            throws Exception {

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

        Element outerDiv = dom.getRootElement();

        HTML_iModeDivRemover divRemover = new HTML_iModeDivRemover();
        divRemover.removeInnerDivTag(outerDiv);
View Full Code Here

                            "some content some more content <br/>" +
                        "</p>" +
                    "</p>" +
                "</body>";

        Document dom = helper.parse(inputText);
        Document expected = helper.parse(expectedText);

        DOMTransformer transformer = new HTML_iModeTableEmulationTransformer();

        HTML_iMode protocol = createProtocol();
        protocol.deviceTablesCapable = false;
View Full Code Here

                        "</p>" +
                        "Bye Allan" +
                    "</p>" +
                "</body>";

        Document dom = helper.parse(inputText);
        Document expected = helper.parse(expectedText);

        DOMTransformer transformer = new HTML_iModeTableEmulationTransformer();

        HTML_iMode protocol = createProtocol();
        protocol.deviceTablesCapable = false;
View Full Code Here

        ProtocolBuilder builder = new ProtocolBuilder();
        DOMProtocol protocol = (DOMProtocol) builder.build(
                new TestProtocolRegistry.TestDOMProtocolFactory(),
                internalDevice);

        Document document = DOMUtilities.read(DOMUtilities.getReader(),
                                              input);

        createTransformer().transform(protocol, document);

        String actual = DOMUtilities.toString(
View Full Code Here

                                    DOMProtocol protocol) {

        StrictStyledDOMHelper helper = new StrictStyledDOMHelper(null);

        String result;
        final Document doc = domFactory.createDocument();
        NodeSequence contents = buffer.removeContents();
        contents.forEach(new NodeIteratee() {
            public IterationAction next(Node node) {
                doc.addNode(node);
                return IterationAction.CONTINUE;
            }
        });

        result = helper.render(doc);
View Full Code Here

        ProtocolBuilder builder = new ProtocolBuilder();
        DOMProtocol protocol = (DOMProtocol) builder.build(
                new TestProtocolRegistry.TestHTML_iModeFactory(),
                internalDevice);

        Document dom = helper.parse(input);
        Document expected = helper.parse(expectedString);
        String domAsString;
        String expectedAsString;
        DOMTransformer transformer = new HTML_iModeDivRemovingTransformer();

        // Useful debug output
View Full Code Here

     * @return          a new parsed/processed dom tree which may be identical
     *                  to the original string passed in.
     */
    protected String getDOMGeneratedString(String inputDOM) throws Exception {
        XMLReader reader = DOMUtilities.getReader();
        Document actualDom = DOMUtilities.read(reader, inputDOM);
        return DOMUtilities.toString(actualDom, protocol.getCharacterEncoder());
    }
View Full Code Here

        TransformingVisitor visitor = createVisitor();
        String input =
                "<b>textA <strong>txt-2</strong> textE <strong>txt-5</strong> a <strong>txt-5</strong> </b>";

        XMLReader reader = DOMUtilities.getReader();
        Document dom = DOMUtilities.read(reader, input);
        visitor.transform(dom);

        String actual = DOMUtilities.toString(dom);

        String expected =
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.