org.dom4j.Namespace.get()方法的使用及代码示例

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

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

Namespace.get介绍

[英]A helper method to return the Namespace instance for no prefix and the URI
[中]用于返回无前缀和URI的命名空间实例的帮助器方法

代码示例

代码示例来源:origin: org.dom4j/dom4j

public Namespace createNamespace(String prefix, String uri) {
  return Namespace.get(prefix, uri);
}

代码示例来源:origin: webx/citrus

schemas.getConfigurationPoints().getConfigurationPointByNamespaceUri(ns.getURI()).getPreferredNsPrefix(), ns.getURI());
ns = Namespace.get(prefix, ns.getURI());
modified = true;

代码示例来源:origin: webx/citrus

schemas.getConfigurationPoints().getConfigurationPointByNamespaceUri(ns.getURI()).getPreferredNsPrefix(), ns.getURI());
ns = Namespace.get(prefix, ns.getURI());
modified = true;

代码示例来源:origin: org.dom4j/dom4j

private void readObject(ObjectInputStream in) throws IOException,
    ClassNotFoundException {
  in.defaultReadObject();
  
  String prefix = (String) in.readObject();
  String uri = (String) in.readObject();
  namespace = Namespace.get(prefix, uri);
}

代码示例来源:origin: webx/citrus

schemas.getConfigurationPoints().getConfigurationPointByNamespaceUri(ns.getURI()).getPreferredNsPrefix(), ns.getURI());
ns = Namespace.get(prefix, ns.getURI());
modified = true;

代码示例来源:origin: org.dom4j/dom4j

public QName get(String qualifiedName, String uri) {
  int index = qualifiedName.indexOf(':');
  if (index < 0) {
    return get(qualifiedName, Namespace.get(uri));
  } else if (index == 0){
    throw new IllegalArgumentException("Qualified name cannot start with ':'.");
  } else {
    String name = qualifiedName.substring(index + 1);
    String prefix = qualifiedName.substring(0, index);
    return get(name, Namespace.get(prefix, uri));
  }
}

代码示例来源:origin: org.dom4j/dom4j

public QName createQName(String name, String prefix, String uri) {
  return cache.get(name, Namespace.get(prefix, uri));
}

代码示例来源:origin: org.dom4j/dom4j

public static QName get(String name, String prefix, String uri) {
  if (((prefix == null) || (prefix.length() == 0)) && (uri == null)) {
    return QName.get(name);
  } else if ((prefix == null) || (prefix.length() == 0)) {
    return getCache().get(name, Namespace.get(uri));
  } else if (uri == null) {
    return QName.get(name);
  } else {
    return getCache().get(name, Namespace.get(prefix, uri));
  }
}

代码示例来源:origin: org.dom4j/dom4j

public Element addElement(String name, String prefix, String uri) {
  Namespace namespace = Namespace.get(prefix, uri);
  QName qName = getDocumentFactory().createQName(name, namespace);
  return addElement(qName);
}

代码示例来源:origin: org.dom4j/dom4j

qName = new QName(localName, Namespace.get(namespaceURI));
} else {
  qName = new QName(localName);

代码示例来源:origin: org.dom4j/dom4j

public void endElement(String namespaceURI, String localName, String qName)
    throws SAXException {
  SAXEvent saxEvent = new SAXEvent(SAXEvent.END_ELEMENT);
  saxEvent.addParm(namespaceURI);
  saxEvent.addParm(localName);
  saxEvent.addParm(qName);
  events.add(saxEvent);
  // check to see if a we issued a start prefix mapping event
  // for DOMDocument namespace decls
  QName elementName;
  if (namespaceURI != null) {
    elementName = new QName(localName, Namespace.get(namespaceURI));
  } else {
    elementName = new QName(localName);
  }
  List<String> prefixes = prefixMappings.get(elementName);
  if (prefixes != null) {
    for (String prefixe : prefixes) {
      SAXEvent prefixEvent =
          new SAXEvent(SAXEvent.END_PREFIX_MAPPING);
      prefixEvent.addParm(prefixe);
      events.add(prefixEvent);
    }
  }
}

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

public QName get(String qualifiedName, String uri) {
  int index = qualifiedName.indexOf(':');
  if (index < 0) {
    return get(qualifiedName, Namespace.get(uri));
  } else if (index == 0){
    throw new IllegalArgumentException("Qualified name cannot start with ':'.");
  } else {
    String name = qualifiedName.substring(index + 1);
    String prefix = qualifiedName.substring(0, index);
    return get(name, Namespace.get(prefix, uri));
  }
}

代码示例来源:origin: maven/dom4j

public QName get(String qualifiedName, String uri) {
  int index = qualifiedName.indexOf(':');
  if (index < 0) {
    return get(qualifiedName, Namespace.get(uri));
  } else {
    String name = qualifiedName.substring(index + 1);
    String prefix = qualifiedName.substring(0, index);
    return get(name, Namespace.get(prefix, uri));
  }
}

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

/**
 * Adds an xml element to the given parent and sets the appropriate namespace and
 * prefix.<p>
 *
 * @param parent the parent node to add the element
 * @param name the name of the new element
 *
 * @return the created element with the given name which was added to the given parent
 */
public static Element addElement(Element parent, String name) {
  return parent.addElement(new QName(name, Namespace.get("D", DEFAULT_NAMESPACE)));
}

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

public static QName get(String name, String prefix, String uri) {
  if (((prefix == null) || (prefix.length() == 0)) && (uri == null)) {
    return QName.get(name);
  } else if ((prefix == null) || (prefix.length() == 0)) {
    return getCache().get(name, Namespace.get(uri));
  } else if (uri == null) {
    return QName.get(name);
  } else {
    return getCache().get(name, Namespace.get(prefix, uri));
  }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.dom4j

public static QName get(String name, String prefix, String uri) {
  if (((prefix == null) || (prefix.length() == 0)) && (uri == null)) {
    return QName.get(name);
  } else if ((prefix == null) || (prefix.length() == 0)) {
    return getCache().get(name, Namespace.get(uri));
  } else if (uri == null) {
    return QName.get(name);
  } else {
    return getCache().get(name, Namespace.get(prefix, uri));
  }
}

代码示例来源:origin: com.alibaba.citrus.tool/antx-autoexpand

public static QName get(String name, String prefix, String uri) {
  if (((prefix == null) || (prefix.length() == 0)) && (uri == null)) {
    return QName.get(name);
  } else if ((prefix == null) || (prefix.length() == 0)) {
    return getCache().get(name, Namespace.get(uri));
  } else if (uri == null) {
    return QName.get(name);
  } else {
    return getCache().get(name, Namespace.get(prefix, uri));
  }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.dom4j

public Element addElement(String name, String prefix, String uri) {
  Namespace namespace = Namespace.get(prefix, uri);
  QName qName = getDocumentFactory().createQName(name, namespace);
  return addElement(qName);
}

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

public Element addElement(String name, String prefix, String uri) {
  Namespace namespace = Namespace.get(prefix, uri);
  QName qName = getDocumentFactory().createQName(name, namespace);
  return addElement(qName);
}

代码示例来源:origin: com.alibaba.citrus.tool/antx-autoexpand

public Element addElement(String name, String prefix, String uri) {
  Namespace namespace = Namespace.get(prefix, uri);
  QName qName = getDocumentFactory().createQName(name, namespace);
  return addElement(qName);
}

相关文章