org.jdom2.Attribute.getQualifiedName()方法的使用及代码示例

x33g5p2x  于11个月前 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(34)

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

Attribute.getQualifiedName介绍

[英]This will retrieve the qualified name of the Attribute. For any XML attribute whose name is [namespacePrefix]:[elementName], the qualified name of the attribute would be everything (both namespace prefix and element name). When the attribute has no namespace, the qualified name is simply the attribute's local name.

To obtain the local name of the attribute, the #getName() method should be used.

To obtain the namespace prefix for this attribute, the #getNamespacePrefix() method should be used.
[中]这将检索Attribute的限定名称。对于名称为[namespacePrefix]:[elementName]的任何XML属性,该属性的限定名称将是所有内容(名称空间前缀和元素名称)。当属性没有名称空间时,限定名称只是属性的本地名称。
要获取属性的本地名称,应使用#getName()方法。
要获取此属性的命名空间前缀,应使用#getNamespacePrefix()方法。

代码示例

代码示例来源:origin: com.thoughtworks.xstream/xstream

public String getAttributeName(int index) {
  return decodeAttribute(currentElement.getAttributes().get(index).getQualifiedName());
}

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

/**
 * This returns a <code>String</code> representation of the
 * <code>Attribute</code>, suitable for debugging.
 *
 * @return <code>String</code> - information about the
 *         <code>Attribute</code>
 */
@Override
public String toString() {
  return new StringBuilder()
  .append("[Attribute: ")
  .append(getQualifiedName())
  .append("=\"")
  .append(value)
  .append("\"")
  .append("]")
  .toString();
}

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

/**
 * This will create an <code>Exception</code> indicating
 * that the addition of the <code>{@link Attribute}</code>
 * to the <code>{@link Element}</code> is illegal.
 *
 * @param base <code>Element</code> that <code>Attribute</code>
 *        couldn't be added to
 * @param added <code>Attribute</code> that could not be added
 * @param reason cause of the problem
 */
IllegalAddException(Element base, Attribute added, String reason) {
  super(new StringBuilder()
  .append("The attribute \"")
  .append(added.getQualifiedName())
  .append("\" could not be added to the element \"")
  .append(base.getQualifiedName())
  .append("\": ")
  .append(reason)
  .toString());
}

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

/**
 * This will handle printing of a {@link Attribute}.
 * 
 * @param fstack
 *        the FormatStack
 * @param basedoc
 *        The org.w3c.dom.Document for creating DOM Nodes
 * @param attribute
 *        <code>Attribute</code> to write.
 * @return The input JDOM Attribute converted to a DOM Attr
 */
protected org.w3c.dom.Attr printAttribute(final FormatStack fstack,
    final org.w3c.dom.Document basedoc, final Attribute attribute) {
  if (!attribute.isSpecified() && fstack.isSpecifiedAttributesOnly()) {
    return null;
  }
  org.w3c.dom.Attr attr = basedoc.createAttributeNS(
      attribute.getNamespaceURI(), attribute.getQualifiedName());
  attr.setValue(attribute.getValue());
  return attr;
}

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

/**
 * This will handle printing of an <code>{@link Attribute}</code>.
 * 
 * @param out
 *        <code>Writer</code> to use.
 * @param fstack
 *        The current FormatStack
 * @param attribute
 *        <code>Attribute</code> to output
 * @throws IOException
 *         if the output fails
 */
protected void printAttribute(final Writer out, final FormatStack fstack,
    final Attribute attribute) throws IOException {
  if (!attribute.isSpecified() && fstack.isSpecifiedAttributesOnly()) {
    return;
  }
  write(out, " ");
  write(out, attribute.getQualifiedName());
  write(out, "=");
  write(out, "\"");
  attributeEscapedEntitiesFilter(out, fstack, attribute.getValue());
  write(out, "\"");
}

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

a.getQualifiedName(),
getAttributeTypeName(a.getAttributeType()),
a.getValue());

代码示例来源:origin: x-stream/xstream

@Override
public String getAttributeName(final int index) {
  return decodeAttribute(currentElement.getAttributes().get(index).getQualifiedName());
}

代码示例来源:origin: org.sonatype.nexus.xstream/xstream

public String getAttributeName(int index) {
  return decodeAttribute(currentElement.getAttributes().get(index).getQualifiedName());
}

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

public String getAttributeName(int index) {
  return decodeAttribute(currentElement.getAttributes().get(index).getQualifiedName());
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.xstream-java8

public String getAttributeName(int index) {
  return decodeAttribute(currentElement.getAttributes().get(index).getQualifiedName());
}

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

public String getAttributeName(int index) {
  return decodeAttribute(currentElement.getAttributes().get(index).getQualifiedName());
}

代码示例来源:origin: org.codehaus.izpack/izpack-util

/**
 * Adds attributes from in element to out element.
 *
 * @param out out element
 * @param in in element
 */
private void addAttributes(Element out, Element in)
{
  LinkedHashMap<String, Attribute> allAttributes = new LinkedHashMap<String, Attribute>();
  List<Attribute> outAttributes = new ArrayList<Attribute>(out.getAttributes());
  List<Attribute> inAttributes = new ArrayList<Attribute>(in.getAttributes());
  for (Attribute attr : outAttributes)
  {
    attr.detach();
    allAttributes.put(attr.getQualifiedName(), attr);
    logger.fine("adding attr from out:" + attr);
  }
  for (Attribute attr : inAttributes)
  {
    attr.detach();
    allAttributes.put(attr.getQualifiedName(), attr);
    logger.fine("adding attr from in:" + attr);
  }
  out.setAttributes(new ArrayList<Attribute>(allAttributes.values()));
}

代码示例来源:origin: org.codehaus.izpack/izpack-util

/**
 * Adds attributes from in element to out element.
 *
 * @param out out element
 * @param in in element
 */
private void addAttributes(Element out, Element in)
{
  LinkedHashMap<String, Attribute> allAttributes = new LinkedHashMap<String, Attribute>();
  List<Attribute> outAttributes = new ArrayList<Attribute>(out.getAttributes());
  List<Attribute> inAttributes = new ArrayList<Attribute>(in.getAttributes());
  for (Attribute attr : outAttributes)
  {
    attr.detach();
    allAttributes.put(attr.getQualifiedName(), attr);
    logger.fine("adding attr from out:" + attr);
  }
  for (Attribute attr : inAttributes)
  {
    attr.detach();
    allAttributes.put(attr.getQualifiedName(), attr);
    logger.fine("adding attr from in:" + attr);
  }
  out.setAttributes(new ArrayList<Attribute>(allAttributes.values()));
}

代码示例来源:origin: org.codehaus.izpack/izpack-util

equalsString(origAttribute.getQualifiedName(), getAttributeName(),
   ignoreCaseAttributeName())))
 if (origAttribute.getQualifiedName().equalsIgnoreCase(patchAttribute.getQualifiedName()))
 if (origAttribute.getQualifiedName().equals(patchAttribute.getQualifiedName()))

代码示例来源:origin: io.wcm.tooling.commons/io.wcm.tooling.commons.crx-packmgr-helper

for (Attribute attribute : attributes) {
 boolean excluded = false;
 if (exclude(attribute.getQualifiedName(), this.excludeProperties)) {
  if (isRepositoryUserGroup && StringUtils.equals(attribute.getQualifiedName(), JcrConstants.JCR_UUID)) {
 else if (StringUtils.equals(attribute.getQualifiedName(), PRIMARYTYPE_PROPERTY)) {
  String namespacePrefix = StringUtils.substringBefore(attribute.getValue(), ":");
  collectNamespacePrefix(namespacePrefixesActuallyUsed, namespacePrefix);
 else if (StringUtils.equals(attribute.getQualifiedName(), MIXINS_PROPERTY)) {
  String filteredValue = filterMixinsPropertyValue(attribute.getValue(), namespacePrefixesActuallyUsed);
  if (StringUtils.isBlank(filteredValue)) {
  collectNamespacePrefixNameArray(namespacePrefixesActuallyUsed, attribute.getQualifiedName(), attribute.getValue());
  attribute.setValue(sortWeakReferenceValues(attribute.getQualifiedName(), attribute.getValue()));

代码示例来源:origin: io.wcm.tooling.commons/io.wcm.tooling.commons.crx-packmgr-helper

private void printAttribute(Writer out, FormatStack fstack, Attribute attribute, boolean printMultiLine) throws IOException {
 if (!attribute.isSpecified() && fstack.isSpecifiedAttributesOnly()) {
  return;
 }
 if (printMultiLine) {
  write(out, StringUtils.defaultString(fstack.getLineSeparator()));
  write(out, StringUtils.defaultString(fstack.getLevelIndent()));
  write(out, StringUtils.defaultString(fstack.getIndent()));
 }
 else {
  write(out, " ");
 }
 write(out, attribute.getQualifiedName());
 write(out, "=");
 write(out, "\"");
 attributeEscapedEntitiesFilter(out, fstack, attribute.getValue());
 write(out, "\"");
}

相关文章