Package org.apache.axis2.om

Examples of org.apache.axis2.om.OMNode


    }

    private void compareChildren(OMElement elementOne, OMElement elementTwo) throws XMLComparisonException {
        Iterator elementOneChildren = elementOne.getChildren();
        while (elementOneChildren.hasNext()) {
            OMNode omNode = (OMNode) elementOneChildren.next();
            if (omNode instanceof OMElement) {
                OMElement elementOneChild = (OMElement) omNode;
                OMElement elementTwoChild = elementTwo.getFirstChildWithName(
                        elementOneChild.getQName());
                if (elementTwoChild == null) {
View Full Code Here


    public static OMElement getChildWithName(OMElement parent,
                                             String childName) {
        Iterator childrenIter = parent.getChildren();
        while (childrenIter.hasNext()) {
            OMNode node = (OMNode) childrenIter.next();
            if (node.getType() == OMNode.ELEMENT_NODE &&
                    childName.equals(((OMElement) node).getLocalName())) {
                return (OMElement) node;
            }
        }
        return null;
View Full Code Here

       if (lastNode.isComplete()) {
             OMElement parent = (OMElement) lastNode.getParent();
             ((OMNodeEx)parent).setComplete(true);
             lastNode = parent;
         } else {
             OMNode e = lastNode;
             ((OMNodeEx)e).setComplete(true);
         }
         elementLevel--;
    }
View Full Code Here

     * @param soapMsg
     */
    private void extractAttachmentNodes(OMElement element, SOAPMessage soapMsg){
      Iterator childIter = element.getChildren();
      while(childIter.hasNext()) {
        OMNode child = (OMNode)childIter.next();
        if(child instanceof OMText){
          OMText binaryNode = (OMText)child;
          DataHandler actualDH = (DataHandler)binaryNode.getDataHandler();
          if(actualDH != null){
            AttachmentPart ap = soapMsg.createAttachmentPart(actualDH);
            String contentId = SessionUtils.generateSessionId();
            ap.setContentId(contentId);
            ap.setContentType(actualDH.getContentType());
            OMElement parent = (OMElement)child.getParent();
            OMAttribute attr = org.apache.axis2.om.OMAbstractFactory.getOMFactory().createOMAttribute("href", null,"cid:"+contentId);
            parent.addAttribute(attr);
            binaryNode.detach();
            soapMsg.addAttachmentPart(ap);
          }
View Full Code Here

    }

    private void sentOutMessage() {
        SOAPFactory omFactory = OMAbstractFactory.getSOAP11Factory();
        SOAPEnvelope env = omFactory.getDefaultEnvelope();
        OMNode testNode = omFactory.createText("This is auto generated messge by the server at " + new Date());
        env.getBody().addChild(testNode);
        log.info("Generated Message" + env.getBody().getFirstChild());

        /*EndpointReference targetEPR = null;
        String action = null;
View Full Code Here

     */
    public OMElement getFirstChildWithName(QName elementQName) throws OMException {
        OMChildrenQNameIterator omChildrenQNameIterator =
                new OMChildrenQNameIterator(getFirstChild(),
                        elementQName);
        OMNode omNode = null;
        if (omChildrenQNameIterator.hasNext()) {
            omNode = (OMNode) omChildrenQNameIterator.next();
        }

        return ((omNode != null) && (OMNode.ELEMENT_NODE == omNode.getType())) ?
                (OMElement) omNode : null;

    }
View Full Code Here

        Iterator children = this.getChildren();

        if (cache) {
            while (children.hasNext()) {
                OMNode omNode = (OMNode) children.next();
                omNode.serializeWithCache(omOutput);
            }
        } else {
            while (children.hasNext()) {
                OMNode omNode = (OMNode) children.next();
                omNode.serialize(omOutput);
            }
        }
    }
View Full Code Here

        if (cache) {
            element.build();
        }

        serializeStartpart(element, omOutput);
        OMNode firstChild = element.firstChild;
        if (firstChild != null) {
            if (cache) {
                firstChild.serializeWithCache(omOutput);
            } else {
                firstChild.serialize(omOutput);
            }
        }
        serializeEndpart(omOutput);
    }
View Full Code Here

    public void characters(char[] ch, int start, int length)
            throws SAXException {
        if (lastNode == null) {
            throw new SAXException("");
        }
        OMNode node;
        if (lastNode.isComplete()) {
            node =
                    factory.createText((OMElement) lastNode.getParent(),
                            new String(ch,
                                    start, length));
View Full Code Here

     * @param rootElt
     */
    private static void markElementsAsOptimized(QName qName,OMElement rootElt){
        if (rootElt.getQName().equals(qName)){
            //get the text node and mark it
            OMNode node = rootElt.getFirstChild();
            if (node.getType()==OMNode.TEXT_NODE){
                ((OMText)node).setOptimize(true);
            }

        }
        Iterator childElements = rootElt.getChildElements();
View Full Code Here

TOP

Related Classes of org.apache.axis2.om.OMNode

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.