org.apache.axiom.om.OMNamespace类的使用及代码示例

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

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

OMNamespace介绍

[英]A namespace binding specifying a namespace prefix and a namespace URI.

Implementations of this interface must be immutable or behave as if they were immutable, i.e. #getPrefix() and #getNamespaceURI() must always return the same values when invoked on the same instance.

Implementations must override Object#equals(Object) and Object#hashCode(). Two OMNamespace instances are considered equal if their namespace URIs and prefixes are equal.
[中]指定名称空间前缀和名称空间URI的名称空间绑定。
此接口的实现必须是不可变的,或者表现为不可变的,即#getPrefix()和#getNamespaceURI()在同一实例上调用时必须始终返回相同的值。
实现必须覆盖对象#equals(Object)和对象#hashCode()。如果两个OMNamespace实例的命名空间URI和前缀相等,则认为它们相等。

代码示例

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

private void addNamespaceToMap(OMNamespace ns, Map<String,String> map) {
  if (map.get(ns.getPrefix()) == null) {
    map.put(ns.getPrefix(), ns.getNamespaceURI());
  }
}

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

/**
 * Retrieves the string-value of a namespace node. This is generally the namespace URI. This may
 * be the empty string but must not be null.
 *
 * @param object the namespace node
 * @return Returns the string-value of the node.
 */
public String getNamespaceStringValue(Object object) {
  return ((OMNamespace) object).getNamespaceURI();
}

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

/**
 * Retrieves the namespace prefix of a namespace node.
 *
 * @param object the namespace node
 * @return Returns the prefix associated with the node.
 */
public String getNamespacePrefix(Object object) {
  return ((OMNamespace) object).getPrefix();
}

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

/**
 * Return true if the SOAP header is an addressing header
 * @param headerBlock SOAP header block to be checked
 * @return true if the SOAP header is an addressing header
 */
private static boolean isAddressingHeader(SOAPHeaderBlock headerBlock) {
  OMNamespace ns = headerBlock.getNamespace();
  return ns != null && (
      AddressingConstants.Submission.WSA_NAMESPACE.equals(ns.getNamespaceURI()) ||
          AddressingConstants.Final.WSA_NAMESPACE.equals(ns.getNamespaceURI()));
}

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

public String getPrefix() {
  if (!element.isExpanded()) {
    element.forceExpand();
  }
  OMNamespace actualNS = element.getNamespace();
  return actualNS == null ? "" : actualNS.getPrefix();
}

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

public boolean equals(Object obj) {
  if (!(obj instanceof OMNamespace)) return false;
  OMNamespace other = (OMNamespace)obj;
  String otherPrefix = other.getPrefix();
  return (uri.equals(other.getNamespaceURI()) &&
      (prefix == null ? otherPrefix == null :
          prefix.equals(otherPrefix)));
}

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

String getNamespaceURI(String prefix) {
  if (currentEvent == START_ELEMENT || currentEvent == END_ELEMENT) {
    if (node instanceof OMElement) {
      OMNamespace namespaceURI =
          ((OMElement) node).findNamespaceURI(prefix);
      return namespaceURI != null ? namespaceURI.getNamespaceURI() : null;
    }
  }
  return null;
}

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

public final OMText createOMText(OMContainer parent, QName text, int type) {
  if (text == null) {
    throw new IllegalArgumentException("QName text arg cannot be null!");
  }
  OMNamespace ns = ((AxiomElement)parent).handleNamespace(text.getNamespaceURI(), text.getPrefix());
  return createAxiomText(parent, ns == null ? text.getLocalPart() : ns.getPrefix() + ":" + text.getLocalPart(), type, false);
}

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

public boolean equals(Object obj) {
  if (!(obj instanceof OMNamespace)) return false;
  OMNamespace other = (OMNamespace)obj;
  String otherPrefix = other.getPrefix();
  return (uri.equals(other.getNamespaceURI()) &&
      (prefix == null ? otherPrefix == null :
          prefix.equals(otherPrefix)));
}

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

public List<QName> getExtensionAttributes() {
  List<QName> list = new ArrayList<QName>();
  for (Iterator i = getAllAttributes(); i.hasNext();) {
    OMAttribute attr = (OMAttribute)i.next();
    String namespace = (attr.getNamespace() != null) ? attr.getNamespace().getNamespaceURI() : "";
    if (!namespace.equals(getNamespace().getNamespaceURI()) && !namespace.equals(""))
      list.add(attr.getQName());
  }
  return Collections.unmodifiableList(list);
}

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

public boolean removeNamespaceDeclaration(String prefix) {
  for (Iterator<OMNamespace> it = omTarget.getAllDeclaredNamespaces(); it.hasNext(); ) {
    if (it.next().getPrefix().equals(prefix)) {
      it.remove();
      return true;
    }
  }
  return false;
}

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

public boolean equals(Object obj) {
  if (!(obj instanceof OMNamespace)) return false;
  OMNamespace other = (OMNamespace)obj;
  String otherPrefix = other.getPrefix();
  return (nsUri.equals(other.getNamespaceURI()) &&
      (nsPrefix == null ? otherPrefix == null :
          nsPrefix.equals(otherPrefix)));
}

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

private SOAPFactory getSOAPFactory(MessageContext msgContext) throws AxisFault {
    String nsURI = msgContext.getEnvelope().getNamespace().getNamespaceURI();
    if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(nsURI)) {
      return OMAbstractFactory.getSOAP12Factory();
    } else if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(nsURI)) {
      return OMAbstractFactory.getSOAP11Factory();
    } else {
      throw new AxisFault(Messages.getMessage("invalidSOAPversion"));
    }
  }
}

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

public boolean equals(Object obj) {
    if (!(obj instanceof OMNamespace)) {
      return false;
    }
    OMNamespace other = (OMNamespace)obj;
    String otherPrefix = other.getPrefix();
    String thisPrefix = getPrefix();
    return (uri.equals(other.getNamespaceURI()) &&
        (thisPrefix == null ? otherPrefix == null :
            thisPrefix.equals(otherPrefix)));
  }
}

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

public SOAPFactory getSOAPFactory(MessageContext msgContext) throws AxisFault {
  String nsURI = msgContext.getEnvelope().getNamespace().getNamespaceURI();
  if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(nsURI)) {
    return OMAbstractFactory.getSOAP12Factory();
  } else if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(nsURI)) {
    return OMAbstractFactory.getSOAP11Factory();
  } else {
    throw new AxisFault(Messages.getMessage("invalidSOAPversion"));
  }
}

代码示例来源:origin: wmixvideo/nfe

private java.util.Map<String, String> getEnvelopeNamespaces(final org.apache.axiom.soap.SOAPEnvelope env) {
  final java.util.Map<String, String> returnMap = new java.util.HashMap<>();
  @SuppressWarnings("rawtypes") final java.util.Iterator namespaceIterator = env.getAllDeclaredNamespaces();
  while (namespaceIterator.hasNext()) {
    final org.apache.axiom.om.OMNamespace ns = (org.apache.axiom.om.OMNamespace) namespaceIterator.next();
    returnMap.put(ns.getPrefix(), ns.getNamespaceURI());
  }
  return returnMap;
}

代码示例来源:origin: org.apache.neethi/neethi

public QName getQName(OMElement s) {
  if (s.getNamespace() == null) {
    return new QName(s.getLocalName());
  }
  return new QName(s.getNamespace().getNamespaceURI(), s.getLocalName());
}
public Map<QName, String> getAttributes(OMElement s) {

代码示例来源:origin: wmixvideo/nfe

private java.util.Map<String, String> getEnvelopeNamespaces(final org.apache.axiom.soap.SOAPEnvelope env) {
  final java.util.Map<String, String> returnMap = new java.util.HashMap<>();
  @SuppressWarnings("rawtypes") final java.util.Iterator namespaceIterator = env.getAllDeclaredNamespaces();
  while (namespaceIterator.hasNext()) {
    final org.apache.axiom.om.OMNamespace ns = (org.apache.axiom.om.OMNamespace) namespaceIterator.next();
    returnMap.put(ns.getPrefix(), ns.getNamespaceURI());
  }
  return returnMap;
}

代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-jms-runtime

@Override
public Object wrap(OMElement template, OMElement os) {
  OMElement wrapper;
  if (os != null) {
    OMNamespace ns = os.declareNamespace(template.getNamespace().getNamespaceURI(), "");
    wrapper = factory.createOMElement(template.getLocalName(), ns);
    wrapper.addChild(os);
  } else {
    wrapper = template.cloneOMElement();
  }
  return wrapper;
}

代码示例来源:origin: wmixvideo/nfe

/**
 * A utility method that copies the namepaces from the SOAPEnvelope
 */
private java.util.Map getEnvelopeNamespaces(final org.apache.axiom.soap.SOAPEnvelope env) {
  final java.util.Map returnMap = new java.util.HashMap();
  final java.util.Iterator namespaceIterator = env.getAllDeclaredNamespaces();
  while (namespaceIterator.hasNext()) {
    final org.apache.axiom.om.OMNamespace ns = (org.apache.axiom.om.OMNamespace) namespaceIterator.next();
    returnMap.put(ns.getPrefix(), ns.getNamespaceURI());
  }
  return returnMap;
}

相关文章

微信公众号

最新文章

更多