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

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

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

OMNamespace.getNamespaceURI介绍

[英]Get the namespace URI. This method never returns null. It may return an empty string if this instance represents a namespace declaration of type xmlns="". This may be the case for instances returned by OMElement#getAllDeclaredNamespaces(). On the other hand, methods such as OMNamedInformationItem#getNamespace() will return null for information items that have no namespace. In that case the returned string is never empty.
[中]获取名称空间URI。此方法永远不会返回null。如果此实例表示类型为xmlns=”“的命名空间声明,则它可能返回空字符串。OmeElement#getAllDeclaredNamespaces()返回的实例可能就是这种情况。另一方面,对于没有名称空间的信息项,OMNamedInformationItem#getNamespace()等方法将返回null。在这种情况下,返回的字符串永远不会为空。

代码示例

代码示例来源: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.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 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

protected Iterator doGetPrefixes(String namespaceURI) {
    List prefixes = new ArrayList();
    for (Iterator it = element.getNamespacesInScope(); it.hasNext(); ) {
      OMNamespace ns = (OMNamespace)it.next();
      if (ns.getNamespaceURI().equals(namespaceURI)) {
        prefixes.add(ns.getPrefix());
      }
    }
    return prefixes.iterator();
  }
}

代码示例来源: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: 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: 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;
}

代码示例来源: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;
}

代码示例来源: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;
}

代码示例来源: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;
}

代码示例来源: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;
}

代码示例来源: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;
}

代码示例来源: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;
}

代码示例来源: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: 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: wmixvideo/nfe

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

代码示例来源: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.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 PushOMBuilder(AxiomSourcedElement root) throws XMLStreamException {
  this.root = root;
  factory = (OMFactoryEx)root.getOMFactory();
  // Seed the namespace context with the namespace context from the parent
  OMContainer parent = root.getParent();
  if (parent instanceof OMElement) {
    for (Iterator it = ((OMElement)parent).getNamespacesInScope(); it.hasNext(); ) {
      OMNamespace ns = (OMNamespace)it.next();
      setPrefix(ns.getPrefix(), ns.getNamespaceURI());
    }
  }
}

相关文章

微信公众号

最新文章

更多