当前位置: 首页>>代码示例>>Java>>正文


Java OMNode.ELEMENT_NODE属性代码示例

本文整理汇总了Java中org.apache.axiom.om.OMNode.ELEMENT_NODE属性的典型用法代码示例。如果您正苦于以下问题:Java OMNode.ELEMENT_NODE属性的具体用法?Java OMNode.ELEMENT_NODE怎么用?Java OMNode.ELEMENT_NODE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.axiom.om.OMNode的用法示例。


在下文中一共展示了OMNode.ELEMENT_NODE属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parseResponseFromRESTService

public static org.apache.ode.bpel.iapi.Message parseResponseFromRESTService(BPELMessageContext
                                                                                    partnerInvocationContext,
                                                                            PartnerRoleMessageExchange
                                                                                    odePartnerMex) {
    org.apache.ode.bpel.iapi.Message messageToODE = odePartnerMex.createMessage(
            odePartnerMex.getOperation().getOutput().getMessage().getQName());
    BindingOperation bindingOp = getBindingOperation(partnerInvocationContext,
            odePartnerMex.getOperationName());
    BindingOutput bindingOutPut = getBindingOutPut(bindingOp);
    javax.wsdl.extensions.mime.MIMEContent mimeContent = getFirstExtensibilityElement(bindingOutPut, MIMEContent
            .class);
    if (mimeContent != null) {
        SOAPEnvelope soapEnv = partnerInvocationContext.getOutMessageContext().getEnvelope();

        Iterator childElementsItr = soapEnv.getBody().getChildElements();
        while (childElementsItr.hasNext()) {
            OMNode child = (OMNode) childElementsItr.next();
            if (child.getType() == OMNode.ELEMENT_NODE) {
                Document doc = DOMUtils.newDocument();
                Element domPart = doc.createElementNS(null, mimeContent.getPart());
                domPart.appendChild(doc.importNode(OMUtils.toDOM((OMElement) child), true));
                messageToODE.setPart(mimeContent.getPart(), domPart);

                return messageToODE;
            }
        }
    }
    throw new IllegalArgumentException("WSO2 BPS only support HTTP binding with mime output.");
}
 
开发者ID:wso2,项目名称:carbon-business-process,代码行数:29,代码来源:SOAPUtils.java

示例2: getValue

/**
 * Returns the the value of the immediate child of this <code>Node</code> object if a child
 * exists and its value is text.
 *
 * @return a <code>String</code> with the text of the immediate child of this <code>Node</code>
 *         object if (1) there is a child and (2) the child is a <code>Text</code> object;
 *         <code>null</code> otherwise
 */
public String getValue() {
    if (element.getType() == OMNode.TEXT_NODE) {
        return element.getText();
    } else if (element.getType() == OMNode.ELEMENT_NODE) {
        final OMNode firstOMChild = element.getFirstOMChild();
        if (firstOMChild instanceof TextImpl) {
            return ((TextImpl)firstOMChild).getData();
        } else if (firstOMChild instanceof SOAPElementImpl) {
            return ((SOAPElementImpl)firstOMChild).getValue();
        }
    }
    return null;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:21,代码来源:SOAPElementImpl.java

示例3: toDOM

public static Element toDOM(OMElement element, Document doc, boolean deepNS) {
    final Element domElement = doc.createElementNS(element.getQName().getNamespaceURI(),
                                                   element.getQName().getLocalPart());

    if (deepNS) {
        NSContext nscontext = new NSContext();
        buildNScontext(nscontext, element);
        DOMUtils.injectNamespaces(domElement,nscontext);
    } else {
        if (element.getAllDeclaredNamespaces() != null) {
            for (Iterator i = element.getAllDeclaredNamespaces(); i.hasNext(); ) {
                OMNamespace omns = (OMNamespace)i.next();
                if (omns.getPrefix().equals("")) {
                    domElement.setAttributeNS(DOMUtils.NS_URI_XMLNS, "xmlns",
                                              omns.getNamespaceURI() == null ? "" :
                                                                        omns.getNamespaceURI());
                }
                else {
                    domElement.setAttributeNS(DOMUtils.NS_URI_XMLNS, "xmlns:"+ omns.getPrefix(),
                                              omns.getNamespaceURI());
                }
            }

        }
    }

    for (Iterator i = element.getAllAttributes(); i.hasNext();) {
        final OMAttribute attr = (OMAttribute) i.next();
        Attr newAttr;
        if (attr.getNamespace() != null) {
            newAttr = doc.createAttributeNS(attr.getNamespace().getNamespaceURI(),
                                            attr.getLocalName());
        } else {
            newAttr = doc.createAttributeNS(null,attr.getLocalName());
        }

        newAttr.appendChild(doc.createTextNode(attr.getAttributeValue()));
        domElement.setAttributeNodeNS(newAttr);

        // Case of qualified attribute values, we're forced to add corresponding namespace declaration manually...
        int colonIdx = attr.getAttributeValue().indexOf(":");
        if (colonIdx > 0) {
            OMNamespace attrValNs = element.findNamespaceURI(attr.getAttributeValue().
                                                                    substring(0, colonIdx));
            if(attrValNs!=null) {
                domElement.setAttributeNS(DOMUtils.NS_URI_XMLNS, "xmlns:"+ attrValNs.getPrefix(),
                                          attrValNs.getNamespaceURI());
            }
        }
    }

    for (Iterator i = element.getChildren(); i.hasNext();) {
        OMNode omn = (OMNode) i.next();

        switch (omn.getType()) {
        case OMNode.CDATA_SECTION_NODE:
            domElement.appendChild(doc.createCDATASection(((OMText)omn).getText()));
            break;
        case OMNode.TEXT_NODE:
            domElement.appendChild(doc.createTextNode(((OMText)omn).getText()));
            break;
        case OMNode.ELEMENT_NODE:
            domElement.appendChild(toDOM((OMElement)omn,doc, false));
            break;
        }

    }

    return domElement;

}
 
开发者ID:wso2,项目名称:carbon-business-process,代码行数:71,代码来源:OMUtils.java

示例4: getIaasProvider

public static IaasProvider getIaasProvider(final String fileName, final OMElement elt, final OMNode item, List<IaasProvider> iaases) {

        IaasProvider iaas = null;

        if (item.getType() == OMNode.ELEMENT_NODE) {

            OMElement iaasElt = (OMElement) item;

            if (iaases != null) {
                // check whether this is a reference to a predefined IaaS.
                for (IaasProvider iaasProvider : iaases) {
                    if (iaasProvider.getType()
                            .equals(iaasElt.getAttribute(new QName(
                                    CloudControllerConstants.TYPE_ATTR))
                                    .getAttributeValue())) {
                        iaas = new IaasProvider(iaasProvider);
                        break;
                    }
                }
            }

            if (iaas == null) {
                iaas = new IaasProvider();
            }

            if (iaas.getType() == null) {
                iaas.setType(iaasElt.getAttribute(new QName(CloudControllerConstants.TYPE_ATTR))
                        .getAttributeValue());
            }

            if ("".equals(iaas.getType())) {
                String msg =
                        "'" + CloudControllerConstants.IAAS_PROVIDER_ELEMENT + "' element's '" +
                                CloudControllerConstants.TYPE_ATTR +
                                "' attribute should be specified!";

                handleException(msg);

            }

            // this is not mandatory
            String name =
                    (iaasElt.getAttribute(new QName(CloudControllerConstants.NAME_ATTR)) == null)
                            ? iaas.getName()
                            : iaasElt.getAttributeValue(new QName(
                            CloudControllerConstants.NAME_ATTR));

            iaas.setName(name);

            String xpath = CloudControllerConstants.IAAS_PROVIDER_ELEMENT_XPATH;

            // load other elements
            loadClassName(fileName, iaas, iaasElt);
            loadProvider(fileName, iaas, iaasElt);
            loadProperties(fileName, iaasElt, iaas.getProperties());
            loadTemplate(fileName, iaas, iaasElt);
            loadIdentity(fileName, elt, iaas, iaasElt);
            loadCredentials(fileName, elt, iaas, iaasElt, xpath);
        }

        return iaas;
    }
 
开发者ID:apache,项目名称:stratos,代码行数:62,代码来源:IaasProviderConfigParser.java

示例5: getElement

private static OMElement getElement(final Object obj) {
    OMNode node;
    if ((obj instanceof OMNode) && (node = (OMNode) obj).getType() == OMNode.ELEMENT_NODE) {

        OMElement element = (OMElement) node;

        return element;

    }

    return null;
}
 
开发者ID:apache,项目名称:stratos,代码行数:12,代码来源:AxiomXpathParserUtil.java


注:本文中的org.apache.axiom.om.OMNode.ELEMENT_NODE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。