org.apache.axiom.om.OMFactory.createOMNamespace()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(9.6k)|赞(0)|评价(0)|浏览(70)

本文整理了Java中org.apache.axiom.om.OMFactory.createOMNamespace()方法的一些代码示例,展示了OMFactory.createOMNamespace()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。OMFactory.createOMNamespace()方法的具体详情如下:
包路径:org.apache.axiom.om.OMFactory
类名称:OMFactory
方法名:createOMNamespace

OMFactory.createOMNamespace介绍

[英]Create an OMNamespace instance or retrieve an existing one if the factory supports pooling.
[中]如果工厂支持池,则创建一个OMNamespace实例或检索一个现有实例。

代码示例

代码示例来源:origin: org.apache.rampart/rampart-core

private static List getDefaultPrefixNamespaces(OMFactory factory)
{
  List<OMNamespace> namespaces = new ArrayList<OMNamespace>();
  // put default namespaces here (sp, soapenv, wsu, etc...)
  namespaces.add(factory.createOMNamespace(WSConstants.ENC_NS, WSConstants.ENC_PREFIX));
  namespaces.add(factory.createOMNamespace(WSConstants.SIG_NS, WSConstants.SIG_PREFIX));
  namespaces.add(factory.createOMNamespace(WSConstants.WSSE_NS, WSConstants.WSSE_PREFIX));
  namespaces.add(factory.createOMNamespace(WSConstants.WSU_NS, WSConstants.WSU_PREFIX));
  
  return namespaces;
  
}

代码示例来源:origin: org.objectweb.petals/petals-ws

/**
 *
 * @param ns
 * @return
 */
public static OMNamespace createOMNamespace(QName ns) {
  OMFactory factory = OMAbstractFactory.getOMFactory();
  return factory.createOMNamespace(ns.getNamespaceURI(), ns.getPrefix());
}

代码示例来源:origin: org.apache.abdera/abdera-parser

private static OMNamespace getOrCreateNamespace(QName qname, OMContainer parent, OMFactory factory) {
  String namespace = qname.getNamespaceURI();
  String prefix = qname.getPrefix();
  if (parent != null && parent instanceof OMElement) {
    OMNamespace ns = ((OMElement)parent).findNamespace(namespace, prefix);
    if (ns != null)
      return ns;
  }
  return factory.createOMNamespace(qname.getNamespaceURI(), qname.getPrefix());
}

代码示例来源:origin: deegree/deegree3

private OMElement createFileIdentifierElement( String id ) {
    OMFactory factory = OMAbstractFactory.getOMFactory();
    OMNamespace namespaceGMD = factory.createOMNamespace( "http://www.isotc211.org/2005/gmd", "gmd" );
    OMNamespace namespaceGCO = factory.createOMNamespace( "http://www.isotc211.org/2005/gco", "gco" );
    OMElement omFileIdentifier = factory.createOMElement( "fileIdentifier", namespaceGMD );
    OMElement omFileCharacterString = factory.createOMElement( "CharacterString", namespaceGCO );
    omFileIdentifier.addChild( omFileCharacterString );
    omFileCharacterString.setText( id );
    return omFileIdentifier;
  }
}

代码示例来源:origin: stackoverflow.com

OMFactory fac = OMAbstractFactory.getOMFactory();
 OMNamespace omNs = fac.createOMNamespace("", "");
 OMElement exec = fac.createOMElement("mynode", omNs);
     OMElement lbtu = fac.createOMElement("givingSomeInstruction", null, mynode);
 lbtu.setText("doOpenABrowser");
 mynode.addChild(lbtu); 
     .......
     .......
     return mynode;
     // Your service method ends here

代码示例来源:origin: org.apache.sandesha2/sandesha2-samples

private static OMElement getPingOMBlock(String text) {
  OMFactory fac = OMAbstractFactory.getOMFactory();
  OMNamespace namespace = fac.createOMNamespace(applicationNamespaceName,"ns1");
  OMElement pingElem = fac.createOMElement(ping, namespace);
  OMElement textElem = fac.createOMElement(Text, namespace);
  
  textElem.setText(text);
  pingElem.addChild(textElem);
  return pingElem;
}

代码示例来源:origin: org.apache.sandesha2/sandesha2-samples

private static OMElement getPingOMBlock(String text) {
  OMFactory fac = OMAbstractFactory.getOMFactory();
  OMNamespace namespace = fac.createOMNamespace(applicationNamespaceName,"ns1");
  OMElement pingElem = fac.createOMElement(ping, namespace);
  OMElement textElem = fac.createOMElement(Text, namespace);
  
  textElem.setText(text);
  pingElem.addChild(textElem);
  return pingElem;
}

代码示例来源:origin: apache/axis2-java

public SOAPElement addAttribute(QName qname, String value) throws SOAPException {
  OMNamespace omNamespace = this.omTarget.getOMFactory().createOMNamespace(qname.getNamespaceURI(), qname.getPrefix());
  this.omTarget.addAttribute(qname.getLocalPart(), value, omNamespace);
  return this;
}

代码示例来源:origin: apache/axis2-java

public static OMElement creatMsg() {
  OMFactory fac = OMAbstractFactory.getOMFactory();
  OMNamespace omNs = fac.createOMNamespace("http://httpsservice.examples.axis2.apache.org",
      "ns1");
  OMElement method = fac.createOMElement("helloService", omNs);
  OMElement value = fac.createOMElement("msg", omNs);
  value.setText("World ");
  method.addChild(value);
  return method;
}

代码示例来源:origin: org.bluestemsoftware.open.eoa.ext/open-eoa-aspect-axiom

public OMNamespace getSOAPBodyFirstElementNS() {
  QName payloadQName = this.getPayloadQName_Optimized();
  if (payloadQName != null) {
    return this.factory.createOMNamespace(payloadQName.getNamespaceURI(), 
                       payloadQName.getPrefix());
  }
  SOAPBody body = this.getBody();
  return (body == null) ? null : body.getFirstElementNS();
}

代码示例来源:origin: org.apache.ws.commons.axiom/axiom-impl

public OMNamespace getSOAPBodyFirstElementNS() {
  QName payloadQName = this.getPayloadQName_Optimized();
  if (payloadQName != null) {
    return getOMFactory().createOMNamespace(payloadQName.getNamespaceURI(), 
                       payloadQName.getPrefix());
  }
  SOAPBody body = this.getBody();
  return (body == null) ? null : body.getFirstElementNS();
}

代码示例来源:origin: org.wso2.xkms/xkms

public OMElement serialize(OMFactory factory) throws XKMSException {
  if (application != null && identifier != null) {
    OMElement useKeyWithEle = factory.createOMElement(XKMS2Constants.ELE_USE_KEY_WITH);
    OMNamespace emptyNs = factory.createOMNamespace("", "");
    useKeyWithEle.addAttribute(XKMS2Constants.ATTR_APPLICATION, application, emptyNs);
    useKeyWithEle.addAttribute(XKMS2Constants.ATTR_IDENTIFIER, identifier, emptyNs);
    return useKeyWithEle;
  } else {
    throw new XKMSException("Required attributes are not available");
  }
}

代码示例来源:origin: org.apache.axis2/axis2-saaj

@Override
protected Element appendElement(Element child) throws SOAPException {     
  OMNamespace ns = omTarget.getOMFactory().createOMNamespace(child.getNamespaceURI(),
                    child.getPrefix());
  SOAPHeaderBlock headerBlock = ((SOAPFactory)this.omTarget.getOMFactory()).createSOAPHeaderBlock(
      child.getLocalName(), ns, omTarget);
   SOAPHeaderElementImpl soapHeaderElement = new SOAPHeaderElementImpl(headerBlock);
  copyContents(soapHeaderElement, child);
  soapHeaderElement.setParentElement(this);
  return soapHeaderElement;
}

代码示例来源:origin: org.apache.sandesha2/sandesha2-core

public OMElement toOMElement(OMElement element) throws OMException,AxisFault {
  OMFactory factory = element.getOMFactory();
  
  if (acksTo == null)
    throw new OMException(SandeshaMessageHelper.getMessage(
        SandeshaMessageKeys.acceptNullAcksTo));
  OMNamespace rmNamespace = factory.createOMNamespace(rmNamespaceValue,Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
  OMElement acceptElement = factory.createOMElement(Sandesha2Constants.WSRM_COMMON.ACCEPT, rmNamespace);
  
  acksTo.toOMElement(acceptElement);
  element.addChild(acceptElement);
  return element;
}

代码示例来源:origin: org.apache.sandesha2/sandesha2-core

public OMElement toOMElement(OMElement element) throws OMException {
  if (duration == null || duration == "")
    throw new OMException(SandeshaMessageHelper.getMessage(
        SandeshaMessageKeys.cannotProcessExpires));
  OMFactory factory = element.getOMFactory();
  
  OMNamespace rmNamespace = factory.createOMNamespace(namespaceValue,Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
  OMElement expiresElement = factory.createOMElement(
      Sandesha2Constants.WSRM_COMMON.EXPIRES, rmNamespace);
  
  expiresElement.setText(duration);
  element.addChild(expiresElement);
  return element;
}

代码示例来源:origin: org.apache.tuscany.sca/tuscany-databinding-axiom

@Override
protected OMElement createElement(QName element, String text, TransformationContext context) {
  OMElement omElement = AxiomHelper.createOMElement(factory, element);
  if (text == null) {
    OMNamespace xsi = factory.createOMNamespace("http://www.w3.org/2001/XMLSchema-instance", "xsi");
    OMAttribute nil = factory.createOMAttribute("nil", xsi, "true");
    omElement.addAttribute(nil);
  } else {
    factory.createOMText(omElement, text);
  }
  return omElement;
}

代码示例来源:origin: org.apache.rampart/rampart-trust

public static OMElement createClaims(int version, 
      OMElement parent, String dialect) throws TrustException{
  OMElement omElem = createOMElement(parent,
      getWSTNamespace(version),
      RahasConstants.IssuanceBindingLocalNames.CLAIMS,
      RahasConstants.WST_PREFIX);
  
  OMNamespace ns = omElem.getOMFactory().createOMNamespace(getWSTNamespace(version), 
      RahasConstants.WSP_PREFIX);
  omElem.addAttribute(RahasConstants.ATTR_CLAIMS_DIALECT , dialect, ns);
    
  return omElem;
}

代码示例来源:origin: org.apache.synapse/synapse-core

public static OMElement serializeXPath(SynapseXPath xpath, String expression,
                    OMElement elem, String attribName) {
  OMNamespace nullNS = elem.getOMFactory()
    .createOMNamespace(XMLConfigConstants.NULL_NAMESPACE, "");
  if (xpath != null && expression != null) {
    elem.addAttribute(elem.getOMFactory().createOMAttribute(
      attribName, nullNS, expression));
    serializeNamespaces(elem, xpath);
  } else {
    handleException("Couldn't find the xpath in the SynapseXPath");
  }
  return elem;
}

代码示例来源:origin: org.apache.synapse/synapse-core

public static OMElement serializeXPath(SynapseXPath xpath, OMElement elem, String attribName) {
  OMNamespace nullNS = elem.getOMFactory()
    .createOMNamespace(XMLConfigConstants.NULL_NAMESPACE, "");
  if (xpath != null) {
    
    elem.addAttribute(elem.getOMFactory().createOMAttribute(
      attribName, nullNS, xpath.toString()));
    serializeNamespaces(elem, xpath);
  } else {
    handleException("Couldn't find the xpath in the SynapseXPath");
  }
  return elem;
}

代码示例来源:origin: org.apache.axis2/axis2-saaj

public SOAPElement addChildElement(SOAPElement soapElement) throws SOAPException {
  OMNamespace ns = omTarget.getOMFactory().createOMNamespace(soapElement.getNamespaceURI(),
                    soapElement.getPrefix());
  SOAPHeaderBlock headerBlock = ((SOAPFactory)this.omTarget.getOMFactory()).createSOAPHeaderBlock(
      soapElement.getLocalName(), ns, omTarget);
  SOAPHeaderElementImpl soapHeaderElement = new SOAPHeaderElementImpl(headerBlock);
  soapHeaderElement.setParentElement(this);
  return soapHeaderElement;
}

相关文章