Examples of OMContainer


Examples of org.apache.axiom.om.OMContainer

    public Iterator getNamespaceAxisIterator(Object contextNode) throws UnsupportedAxisException {
        if (!(contextNode instanceof OMContainer &&
                contextNode instanceof OMElement)) {
            return JaxenConstants.EMPTY_ITERATOR;
        }
        OMContainer omContextNode = (OMContainer) contextNode;
        List nsList = new ArrayList();
        HashSet prefixes = new HashSet();
        for (OMContainer context = omContextNode;
             context != null && !(context instanceof OMDocument);
             context = ((OMElement) context).getParent()) {
            OMElement element = (OMElement) context;
            ArrayList declaredNS = new ArrayList();
            Iterator i = element.getAllDeclaredNamespaces();
            while (i != null && i.hasNext()) {
                declaredNS.add(i.next());
            }
            declaredNS.add(element.getNamespace());
            for (Iterator iter = element.getAllAttributes();
                 iter != null && iter.hasNext();) {
                OMAttribute attr = (OMAttribute) iter.next();
                OMNamespace namespace = attr.getNamespace();
                if (namespace != null) {
                    declaredNS.add(namespace);
                }
            }
            for (Iterator iter = declaredNS.iterator();
                 iter != null && iter.hasNext();) {
                OMNamespace namespace = (OMNamespace) iter.next();
                if (namespace != null) {
                    String prefix = namespace.getPrefix();
                    if (prefix != null && !prefixes.contains(prefix)) {
                        prefixes.add(prefix);
                        nsList.add(new OMNamespaceEx(namespace, context));
                    }
                }
            }
        }
        nsList.add(
                new OMNamespaceEx(
                        omContextNode.getOMFactory().createOMNamespace(
                                "http://www.w3.org/XML/1998/namespace",
                                "xml"),
                        omContextNode));
        return nsList.iterator();
    }
View Full Code Here

Examples of org.apache.axiom.om.OMContainer

     */
    public Object getDocumentNode(Object contextNode) {
        if (contextNode instanceof OMDocument) {
            return contextNode;
        }
        OMContainer parent = ((OMNode) contextNode).getParent();
        if (parent == null) {
            // this node doesn't have a parent Document. So return the document element itself
            return contextNode;
        } else {
            return getDocumentNode(parent);
View Full Code Here

Examples of org.apache.axiom.om.OMContainer

                        }
                       
                    }
                   
   
                    OMContainer o = om;
                    while (o != null && o instanceof OMContainerEx) {
                        ((OMContainerEx)o).setComplete(true);
                        if ((o instanceof OMNode) &&
                                (((OMNode)o).getParent()) instanceof OMContainer) {
                            o = ((OMNode)o).getParent();
View Full Code Here

Examples of org.apache.axiom.om.OMContainer

            }
            if (log.isDebugEnabled()) {
                log.debug("Transformation result : " + result);
            }

            OMContainer parent = sourceNode.getParent();
            if (parent instanceof SOAPEnvelope) {
                ((SOAPEnvelope) parent).getBody().getFirstOMChild().detach();
                ((SOAPEnvelope) parent).getBody().setFirstChild(result);
            } else {
                parent.getFirstOMChild().detach();
                parent.addChild(result);
            }

        } catch (TransformerException e) {
            handleException("Error performing XSLT transformation " + xsltKey, e);
        } catch (XMLStreamException e) {
View Full Code Here

Examples of org.apache.axiom.om.OMContainer

            if (log.isDebugEnabled()) {
                log.debug("Transformation result : " + result);
            }

            OMContainer parent = sourceNode.getParent();
            if (parent instanceof SOAPEnvelope) {
                ((SOAPEnvelope) parent).getBody().getFirstOMChild().detach();
                ((SOAPEnvelope) parent).getBody().setFirstChild(result);
            } else {
                parent.getFirstOMChild().detach();
                parent.addChild(result);
            }

        } catch (TransformerException e) {
            handleException("Error performing XSLT transformation " + xsltKey, e);
        } catch (XMLStreamException e) {
View Full Code Here

Examples of org.apache.axiom.om.OMContainer

        // invoke transformation, with static enveope
        MessageContext synCtx = TestUtils.getTestContext(SOURCE, props);
        transformMediator.mediate(synCtx);

        // validate result
        OMContainer body = synCtx.getEnvelope().getBody();
        if (body.getFirstOMChild() instanceof OMElement) {

            OMElement getQuoteElem = (OMElement) body.getFirstOMChild();
            assertTrue("GetQuote".equals(getQuoteElem.getLocalName()));
            assertTrue("http://www.webserviceX.NET/".equals(getQuoteElem.getNamespace().getName()));

            OMElement symbolElem = getQuoteElem.getFirstElement();
            assertTrue("symbol".equals(symbolElem.getLocalName()));
View Full Code Here

Examples of org.apache.axiom.om.OMContainer

        // invoke transformation, with static enveope
        MessageContext synCtx = TestUtils.getTestContext(SOURCE, props);
        transformMediator.mediate(synCtx);

        // validate result
        OMContainer body = synCtx.getEnvelope().getBody();
        if (body.getFirstOMChild() instanceof OMElement) {

            OMElement getQuoteElem = (OMElement) body.getFirstOMChild();
            assertTrue("GetQuote".equals(getQuoteElem.getLocalName()));
            assertTrue("http://www.webserviceX.NET/".equals(getQuoteElem.getNamespace().getName()));

            OMElement symbolElem = getQuoteElem.getFirstElement();
            assertTrue("symbol".equals(symbolElem.getLocalName()));
View Full Code Here

Examples of org.apache.axiom.om.OMContainer

        // invoke transformation, with static enveope
        MessageContext synCtx = TestUtils.getTestContext(ENCLOSING_SOURCE, props);
        transformMediator.mediate(synCtx);

        // validate result
        OMContainer body = synCtx.getEnvelope().getBody();
        if (body.getFirstOMChild() instanceof OMElement) {

            OMElement someOtherElem = (OMElement) body.getFirstOMChild();
            assertTrue("someOtherElement".equals(someOtherElem.getLocalName()));
            assertTrue("http://someother".equals(someOtherElem.getNamespace().getName()));

            OMElement getQuoteElem = (OMElement) someOtherElem.getFirstOMChild();
            assertTrue("GetQuote".equals(getQuoteElem.getLocalName()));
View Full Code Here

Examples of org.apache.axiom.om.OMContainer

      if (lastNode == null) {
          return null;
      } else if (!lastNode.isComplete()) {
          node = createOMText(value, (OMElement) lastNode, textType);
      } else {
          OMContainer parent = lastNode.getParent();
          if (!(parent instanceof OMDocument)) {
              node = createOMText(value, (OMElement) parent, textType);
          }
      }
      return node;
View Full Code Here

Examples of org.apache.axiom.om.OMContainer

                        throw new SynapseException(msg, je);
                    }
                }
            }

            OMContainer parent = currentElem.getParent();
            //if the parent is a document element or parent is null ,then return
            if (parent == null || parent instanceof OMDocument) {
                return;
            }
            if (parent instanceof OMElement) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.