org.w3c.dom.Node.lookupPrefix()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(5.7k)|赞(0)|评价(0)|浏览(113)

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

Node.lookupPrefix介绍

[英]Look up the prefix associated to the given namespace URI, starting from this node. The default namespace declarations are ignored by this method.
See for details on the algorithm used by this method.
[中]从该节点开始查找与给定名称空间URI关联的前缀。此方法将忽略默认命名空间声明。
有关此方法使用的算法的详细信息,请参阅。

代码示例

代码示例来源:origin: pmd/pmd

@Override
public String lookupPrefix(String namespaceURI) {
  return node.lookupPrefix(namespaceURI);
}

代码示例来源:origin: fbacchella/jrds

/**
 * @param namespaceURI
 * @return
 * @see org.w3c.dom.Node#lookupPrefix(java.lang.String)
 */
public String lookupPrefix(String namespaceURI) {
  return parent.lookupPrefix(namespaceURI);
}

代码示例来源:origin: org.jboss.ws.native/jbossws-native-core

public String lookupPrefix(String namespaceURI)
{
 return this.domNode.lookupPrefix(namespaceURI);
}

代码示例来源:origin: org.vx68k.quercus/quercus

public String lookupPrefix(String namespaceURI)
{
 return _delegate.lookupPrefix(namespaceURI);
}

代码示例来源:origin: xyz.cofe/common

@Override
public String lookupPrefix(String namespaceURI) {
  return node.lookupPrefix(namespaceURI);
}

代码示例来源:origin: apache/servicemix-bundles

@Override
public String getPrefix(String uri) {
  return _current.lookupPrefix(uri);
}

代码示例来源:origin: org.codehaus.service-conduit/sca4j-transform

public String getPrefix(String uri) throws XMLStreamException {
  return node.lookupPrefix(uri);
}

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

public final String lookupPrefix(String namespaceURI) {
  return target.lookupPrefix(namespaceURI);
}

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

public final String lookupPrefix(String namespaceURI) {
  return target.lookupPrefix(namespaceURI);
}

代码示例来源:origin: org.codehaus.service-conduit/sca4j-transform

private String addPrefix(String namespaceURI, String localName) {
  String prefix = node.lookupPrefix(namespaceURI);
  if (prefix == null) {
    // TODO default prefix
    throw new UnsupportedOperationException();
  }
  return prefix + ':' + localName;
}

代码示例来源:origin: pl.touk.ode.validator/ode-validator

private String lookupPrefix(String ns) {
  if (node != null) {
    return node.lookupPrefix(ns);
  } else {
    for (String p : prefixMap.keySet()) {
      if (prefixMap.get(p).equals(ns)) return p;
    }
    return null;
  }
}

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

@Override
  protected void runTest() throws Throwable {
    Document document = dbf.newDocumentBuilder().parse(new InputSource(new StringReader(
        "<a xmlns='urn:test'><b xmlns=''/></a>")));
    assertNull(document.getDocumentElement().getFirstChild().lookupPrefix(""));
  }
}

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

@Override
  protected void runTest() throws Throwable {
    Document document = dbf.newDocumentBuilder().parse(new InputSource(new StringReader(
        "<root xmlns:p='urn:ns1'><child xmlns:p='urn:ns2'/></root>")));
    assertNull(document.getDocumentElement().getFirstChild().lookupPrefix("urn:ns1"));
  }
}

代码示例来源:origin: com.marklogic/marklogic-mapreduce2

/** {@inheritDoc} */
@Override
public String lookupPrefix(String namespaceURI) {
  return getParentNode().lookupPrefix(namespaceURI);
}

代码示例来源:origin: apache/cxf

public void addNamespaces(final Node targetNode) {
  NamedNodeMap attributes = targetNode.getAttributes();
  for (int i = 0; i < attributes.getLength(); i++) {
    Node a = attributes.item(i);
    String prefix = a.getLocalName();
    String ns = a.getNodeValue();
    if (prefix != null
      && !context.getUsedNamespaces().containsKey(prefix)
      && targetNode.lookupPrefix(ns) != null) {
      if ("xmlns".equals(prefix)) {
        continue;
      }
      context.addNamespace(prefix, ns);
    }
  }
}

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

/**
 * Search for a child with the given nodeName. If recursive, search in all
 * the child of firdt level, then if not found, search in the 2nd level of
 * the first child, ...
 *
 * @param node
 *            parent node
 * @param namespaceURI
 *            The namespaceURI of the node
 * @param nodeName
 *            node name
 * @param recursive
 *            boolean to know if we got through the xml tree
 * @return a node
 */
public static Node findChild(final Node node, final String namespaceURI,
    final String nodeName, final boolean recursive) {
  node.normalize();
  final String prefix = node.lookupPrefix(namespaceURI);
  return XMLUtil.findChild(node, prefix + nodeName, recursive);
}

代码示例来源:origin: org.ow2.petals/petals-kernel

/**
 * Search for a child with the given nodeName. If recursive, search in all
 * the child of firdt level, then if not found, search in the 2nd level of
 * the first child, ...
 * 
 * @param node
 *            parent node
 * @param namespaceURI
 *            The namespaceURI of the node
 * @param nodeName
 *            node name
 * @param recursive
 *            boolean to know if we got through the xml tree
 * @return a node
 */
public static Node findChild(final Node node, final String namespaceURI, final String nodeName,
    final boolean recursive) {
  node.normalize();
  String prefix = node.lookupPrefix(namespaceURI);
  return findChild(node, prefix + nodeName, recursive);
}

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

/**
 * Search for a child with the given nodeName. If recursive, search in all
 * the child of firdt level, then if not found, search in the 2nd level of
 * the first child, ...
 * 
 * @param node
 *            parent node
 * @param namespaceURI
 *            The namespaceURI of the node
 * @param nodeName
 *            node name
 * @param recursive
 *            boolean to know if we got through the xml tree
 * @return a node
 */
public static Node findChild(final Node node, final String namespaceURI,
  final String nodeName, final boolean recursive) {
  node.normalize();
  String prefix = node.lookupPrefix(namespaceURI);
  return findChild(node, prefix + nodeName, recursive);
}

代码示例来源:origin: com.sun.phobos/phobos-rhino

private String getExistingPrefixFor(Namespace namespace) {
  if (getDefaultNamespace().getUri().equals(namespace.getUri())) {
    return "";
  }
  return dom.lookupPrefix(namespace.getUri());
}

代码示例来源:origin: com.github.tntim96/rhino

private String getExistingPrefixFor(Namespace namespace) {
  if (getDefaultNamespace().getUri().equals(namespace.getUri())) {
    return "";
  }
  return dom.lookupPrefix(namespace.getUri());
}

相关文章