org.dom4j.Element.getQualifiedName()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(8.1k)|赞(0)|评价(0)|浏览(313)

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

Element.getQualifiedName介绍

[英]Returns the fully qualified name of this element. This will be the same as the value returned from #getNameif this element has no namespace attached to this element or an expression of the form

getNamespacePrefix() + ":" + getName()

will be returned.
[中]返回此元素的完全限定名。如果此元素没有附加到该元素的命名空间,或者将返回格式为

getNamespacePrefix() + ":" + getName()

的表达式,则该值将与从#GetName返回的值相同。

代码示例

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

public String getElementQName(Object obj)
{
  Element elem = (Element) obj;
  return elem.getQualifiedName();
}

代码示例来源:origin: igniterealtime/Openfire

/** <p>Writes the opening tag of an {@link Element},
 * including its {@link Attribute}s
 * but without its content.</p>
 *
 * @param element <code>Element</code> to output.
 */
public void writeOpen(Element element) throws IOException {
  writer.write("<");
  writer.write( element.getQualifiedName() );
  writeAttributes(element);
  writer.write(">");
}

代码示例来源:origin: igniterealtime/Openfire

/** <p>Writes the closing tag of an {@link Element}</p>
 *
 * @param element <code>Element</code> to output.
 */
public void writeClose(Element element) throws IOException {
  writeClose( element.getQualifiedName() );
}

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

@Override
  protected void match(Node node) {
    // System.out.println(node.toString());
    if (node instanceof Element) {
      Element element = (Element) node;
      System.out.println("Element: " + element.getQualifiedName());
      System.out.println("\tText: " + element.getText());
      System.out.println("\tAttributes:");
      for (Iterator<?> i = element.attributeIterator(); i.hasNext();) {
        Attribute attribute = (Attribute) i.next();
        System.out.println("\t\t" + attribute.getName() + "=" + attribute.getValue());
      }
    } else if (node instanceof Attribute) {
      Attribute attribute = (Attribute) node;
      System.out.println("Attribute: " + attribute.getName() + "=" + attribute.getValue());
    }
  }
};

代码示例来源:origin: igniterealtime/Openfire

protected void writeElement(Element element) throws IOException {
  int size = element.nodeCount();
  String qualifiedName = element.getQualifiedName();

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

public String getRawName() {
  return element.getQualifiedName();
}

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

public IllegalAddException(Element parent, Node node, String reason) {
  super("The node \"" + node.toString()
      + "\" could not be added to the element \""
      + parent.getQualifiedName() + "\" because: " + reason);
}

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

protected void endElement(Element element) throws SAXException {
  contentHandler.endElement(element.getNamespaceURI(), element.getName(),
      element.getQualifiedName());
}

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

/**
 * <p>
 * Writes the closing tag of an {@link Element}
 * </p>
 * 
 * @param element
 *            <code>Element</code> to output.
 * 
 * @throws IOException
 *             DOCUMENT ME!
 */
public void writeClose(Element element) throws IOException {
  writeClose(element.getQualifiedName());
}

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

protected void startElement(Element element,
    AttributesImpl namespaceAttributes) throws SAXException {
  contentHandler.startElement(element.getNamespaceURI(), element
      .getName(), element.getQualifiedName(), createAttributes(
      element, namespaceAttributes));
}

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

/**
 * <p>
 * Writes the opening tag of an {@link Element}, including its {@link
 * Attribute}s but without its content.
 * </p>
 * 
 * @param element
 *            <code>Element</code> to output.
 * 
 * @throws IOException
 *             DOCUMENT ME!
 */
public void writeOpen(Element element) throws IOException {
  writer.write("<");
  writer.write(element.getQualifiedName());
  writeNamespaces(element);
  writeAttributes(element);
  writer.write(">");
}

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

protected void checkAddElementAllowed(Element element) {
  Element root = getRootElement();
  if (root != null) {
    throw new IllegalAddException(this, element,
        "Cannot add another element to this "
            + "Document as it already has a root "
            + "element of: " + root.getQualifiedName());
  }
}

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

private String reformatSchemaLocations(String schemaLocation) {
  Map<String, String> schemaLocations = parseSchemaLocation(schemaLocation);
  String locationPrefix = guessLocationPrefix(schemaLocations, schemas);
  // 将缺少的schema location补充完整。
  for (String namespaceURI : allSchemaNamespaces.keySet()) {
    if (!schemaLocations.containsKey(namespaceURI)) {
      try {
        Set<Schema> schemaSet = schemas.getNamespaceMappings().get(namespaceURI);
        if (schemaSet != null && schemaSet.size() > 0) {
          schemaLocations.put(namespaceURI, locationPrefix + schemaSet.iterator().next().getName());
          modified = true;
        }
      } catch (Exception ignored) {
      }
    }
  }
  return formatSchemaLocations(schemaLocations, root.getQualifiedName());
}

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

private String reformatSchemaLocations(String schemaLocation) {
  Map<String, String> schemaLocations = parseSchemaLocation(schemaLocation);
  String locationPrefix = guessLocationPrefix(schemaLocations, schemas);
  // 将缺少的schema location补充完整。
  for (String namespaceURI : allSchemaNamespaces.keySet()) {
    if (!schemaLocations.containsKey(namespaceURI)) {
      try {
        Set<Schema> schemaSet = schemas.getNamespaceMappings().get(namespaceURI);
        if (schemaSet != null && schemaSet.size() > 0) {
          schemaLocations.put(namespaceURI, locationPrefix + schemaSet.iterator().next().getName());
          modified = true;
        }
      } catch (Exception ignored) {
      }
    }
  }
  return formatSchemaLocations(schemaLocations, root.getQualifiedName());
}

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

private String reformatSchemaLocations(String schemaLocation) {
  Map<String, String> schemaLocations = parseSchemaLocation(schemaLocation);
  String locationPrefix = guessLocationPrefix(schemaLocations, schemas);
  // 将缺少的schema location补充完整。
  for (String namespaceURI : allSchemaNamespaces.keySet()) {
    if (!schemaLocations.containsKey(namespaceURI)) {
      try {
        Set<Schema> schemaSet = schemas.getNamespaceMappings().get(namespaceURI);
        if (schemaSet != null && schemaSet.size() > 0) {
          schemaLocations.put(namespaceURI, locationPrefix + schemaSet.iterator().next().getName());
          modified = true;
        }
      } catch (Exception ignored) {
      }
    }
  }
  return formatSchemaLocations(schemaLocations, root.getQualifiedName());
}

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

protected void addNode(int index, Node node) {
  if (node.getParent() != null) {
    // XXX: could clone here
    String message = "The Node already has an existing parent of \""
            + node.getParent().getQualifiedName() + "\"";
    throw new IllegalAddException(this, node, message);
  }
  addNewNode(index, node);
}

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

protected void addNode(Node node) {
  if (node.getParent() != null) {
    // XXX: could clone here
    String message = "The Node already has an existing parent of \""
            + node.getParent().getQualifiedName() + "\"";
    throw new IllegalAddException(this, node, message);
  }
  addNewNode(node);
}

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

public void add(Attribute attribute) {
  if (attribute.getParent() != null) {
    String message = "The Attribute already has an existing parent \""
            + attribute.getParent().getQualifiedName() + "\"";
    throw new IllegalAddException(this, attribute, message);
  }
  if (attribute.getValue() == null) {
    // try remove a previous attribute with the same
    // name since adding an attribute with a null value
    // is equivalent to removing it.
    Attribute oldAttribute = attribute(attribute.getQName());
    if (oldAttribute != null) {
      remove(oldAttribute);
    }
  } else {
    attributeList().add(attribute);
    childAdded(attribute);
  }
}

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

public void add(Attribute attribute) {
  if (attribute.getParent() != null) {
    String message = "The Attribute already has an existing parent \""
        + attribute.getParent().getQualifiedName() + "\"";
    throw new IllegalAddException(this, attribute, message);
  }
  if (attribute.getValue() == null) {
    // try remove a previous attribute with the same
    // name since adding an attribute with a null value
    // is equivalent to removing it.
    Attribute oldAttribute = attribute(attribute.getQName());
    if (oldAttribute != null) {
      remove(oldAttribute);
    }
  } else {
    if (attributes == null) {
      attributes = attribute;
    } else {
      attributeList().add(attribute);
    }
    childAdded(attribute);
  }
}

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

Element element = new Element(dom4jElement.getQualifiedName(), dom4jElement.getNamespaceURI());

相关文章

微信公众号

最新文章

更多

Element类方法