Package org.apache.axiom.om.impl.dom.factory

Examples of org.apache.axiom.om.impl.dom.factory.OMDOMFactory


    }

    public void testCreateText() {
        String textValue = "temp text value";

        OMDOMFactory fac = new OMDOMFactory();
        DocumentImpl doc = new DocumentImpl(fac);
        Text txt = doc.createTextNode(textValue);

        assertEquals("Text value mismatch", textValue, txt.getData());
    }
View Full Code Here


    }

    public void testSplitText() {
        String textValue = "temp text value";

        OMDOMFactory fac = new OMDOMFactory();
        DocumentImpl doc = new DocumentImpl(fac);

        Text txt = doc.createTextNode(textValue);
        txt.splitText(3);
View Full Code Here

        try {
            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
            dbf.setNamespaceAware(true);
            Document doc = dbf.newDocumentBuilder().parse(
                    new FileInputStream("test-resources/xml/sigEncr.xml"));
            Node n = new OMDOMFactory().getDocument().importNode(doc.getDocumentElement(), true);
            OMTestUtils.compare(doc.getDocumentElement(), (OMElement) n);
        } catch (Exception e) {
            e.printStackTrace();
            fail(e.getMessage());
        }
View Full Code Here

    public OMDOMFactoryTest(String name) {
        super(name);
    }

    public void testCreateElement() {
        OMDOMFactory factory = new OMDOMFactory();
        String localName = "TestLocalName";
        String namespace = "http://ws.apache.org/axis2/ns";
        String prefix = "axis2";
        OMElement elem = factory.createOMElement(localName, namespace, prefix);
        QName qname = elem.getQName();

        assertEquals("Localname mismatch", localName, qname.getLocalPart());
        assertEquals("Namespace mismatch", namespace, qname.getNamespaceURI());
        assertEquals("namespace prefix mismatch", prefix, qname.getPrefix());
View Full Code Here

    public TextImplTest(String name) {
        super(name);
    }

    public void testSetText() {
        OMDOMFactory factory = new OMDOMFactory();
        String localName = "TestLocalName";
        String namespace = "http://ws.apache.org/axis2/ns";
        String prefix = "axis2";
        String tempText = "The quick brown fox jumps over the lazy dog";

        OMElement elem = factory.createOMElement(localName, namespace, prefix);
        OMText textNode = factory.createOMText(elem, tempText);

        assertEquals("Text value mismatch", tempText, textNode.getText());
    }
View Full Code Here

        assertEquals("Text value mismatch", tempText, textNode.getText());
    }

    public void testAppendText() {
        OMDOMFactory factory = new OMDOMFactory();
        String localName = "TestLocalName";
        String namespace = "http://ws.apache.org/axis2/ns";
        String prefix = "axis2";
        String tempText = "The quick brown fox jumps over the lazy dog";
        String textToAppend = " followed by another fox";

        OMElement elem = factory.createOMElement(localName, namespace, prefix);
        OMText textNode = factory.createOMText(elem, tempText);

        ((Text) textNode).appendData(textToAppend);

        assertEquals("Text value mismatch", tempText + textToAppend, textNode
                .getText());
View Full Code Here

    public ElementImplTest(String name) {
        super(name);
    }

    public void testSetText() {
        OMDOMFactory factory = new OMDOMFactory();
        String localName = "TestLocalName";
        String namespace = "http://ws.apache.org/axis2/ns";
        String prefix = "axis2";
        OMElement elem = factory.createOMElement(localName, namespace, prefix);

        String text = "The quick brown fox jumps over the lazy dog";

        elem.setText(text);
View Full Code Here

        assertEquals("Text value mismatch", text, elem.getText());

    }

    public void testSerialize() {
        OMDOMFactory factory = new OMDOMFactory();
        String localName = "TestLocalName";
        String namespace = "http://ws.apache.org/axis2/ns";
        String prefix = "axis2";
        String tempText = "The quick brown fox jumps over the lazy dog";
        String textToAppend = " followed by another";

        OMElement elem = factory.createOMElement(localName, namespace, prefix);
        OMText textNode = factory.createOMText(elem, tempText);

        ((Text) textNode).appendData(textToAppend);
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        try {
            elem.serialize(baos);
View Full Code Here

            fail(e.getMessage());
        }
    }

    public void testAddChild() {
        OMDOMFactory factory = new OMDOMFactory();
        String localName = "TestLocalName";
        String childLocalName = "TestChildLocalName";
        String namespace = "http://ws.apache.org/axis2/ns";
        String prefix = "axis2";

        OMElement elem = factory.createOMElement(localName, namespace, prefix);
        OMElement childElem = factory.createOMElement(childLocalName, namespace, prefix);

        elem.addChild(childElem);

        Iterator it = elem.getChildrenWithName(new QName(namespace, childLocalName));
View Full Code Here

     * @return the new <code>SOAPElement</code> object that was created
     * @throws javax.xml.soap.SOAPException if there is an error in creating the <code>SOAPElement</code>
     *                                      object
     */
    public SOAPElement createElement(String localName) throws SOAPException {
        OMDOMFactory omdomFactory = null;
        if (soapVersion.equals(SOAPConstants.SOAP_1_2_PROTOCOL)) {
            omdomFactory = (OMDOMFactory)DOOMAbstractFactory.getSOAP12Factory();
        } else {
            omdomFactory = (OMDOMFactory)DOOMAbstractFactory.getSOAP11Factory();
        }
        OMElement omElement = omdomFactory.createOMElement(new QName(localName));
        return new SOAPElementImpl((ElementImpl)omElement);
    }
View Full Code Here

TOP

Related Classes of org.apache.axiom.om.impl.dom.factory.OMDOMFactory

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.