gpt4 book ai didi

com.google.gdata.util.common.xml.XmlWriter.ensureUniqueNamespaceAlias()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-18 12:40:40 26 4
gpt4 key购买 nike

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

XmlWriter.ensureUniqueNamespaceAlias介绍

[英]Ensures a unique namespace alias within an element. If the alias has already been associated with a different URI, then a unique alias prefix value will be set for the namespace.
[中]确保元素中有唯一的命名空间别名。如果别名已与其他URI关联,则将为命名空间设置唯一的别名前缀值。

代码示例

代码示例来源:origin: com.google.gdata/gdata-core-1.0

/**
 * Ensures the namespace is in scope and returns its alias.
 * The top of the stack is assumed to be the current element.
 * If the namespace is not found, it is appended to the current element.
 *
 * @return  namespace alias or {@code null} for the default namespace.
 */
protected String ensureNamespace(XmlNamespace namespace) {
 // Return the default namespace if possible.  There is no need to add
 // here, as it has already been added (with a null alias) by startElement()
 // if the default namespace is set or changed.
 if (namespace.uri.equals(defaultNamespace)) {
  return null;
 }
 String alias = checkNamespace(namespace.uri);
 // If not found, insert this namespace.
 if (alias == null) {
  Element current = currentElement();
  namespace = ensureUniqueNamespaceAlias(current, namespace);
  current.addNamespace(namespace);
  alias = namespace.alias;
 }
 return alias;
}

代码示例来源:origin: com.mulesoft.google/google-api-gdata

/**
 * Ensures the namespace is in scope and returns its alias.
 * The top of the stack is assumed to be the current element.
 * If the namespace is not found, it is appended to the current element.
 *
 * @return  namespace alias or {@code null} for the default namespace.
 */
protected String ensureNamespace(XmlNamespace namespace) {
 // Return the default namespace if possible.  There is no need to add
 // here, as it has already been added (with a null alias) by startElement()
 // if the default namespace is set or changed.
 if (namespace.uri.equals(defaultNamespace)) {
  return null;
 }
 String alias = checkNamespace(namespace.uri);
 // If not found, insert this namespace.
 if (alias == null) {
  Element current = currentElement();
  namespace = ensureUniqueNamespaceAlias(current, namespace);
  current.addNamespace(namespace);
  alias = namespace.alias;
 }
 return alias;
}

代码示例来源:origin: com.google.gdata/gdata-java-client

/**
 * Ensures the namespace is in scope and returns its alias.
 * The top of the stack is assumed to be the current element.
 * If the namespace is not found, it is appended to the current element.
 *
 * @return  namespace alias or {@code null} for the default namespace.
 */
protected String ensureNamespace(XmlNamespace namespace) {
 // Return the default namespace if possible.  There is no need to add
 // here, as it has already been added (with a null alias) by startElement()
 // if the default namespace is set or changed.
 if (namespace.uri.equals(defaultNamespace)) {
  return null;
 }
 String alias = checkNamespace(namespace.uri);
 // If not found, insert this namespace.
 if (alias == null) {
  Element current = currentElement();
  namespace = ensureUniqueNamespaceAlias(current, namespace);
  current.addNamespace(namespace);
  alias = namespace.alias;
 }
 return alias;
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com