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

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

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

Element.declaredNamespaces介绍

[英]Returns all the namespaces declared by this element. If no namespaces are declared for this element then an empty list will be returned. The list is backed by the element such that changes to the list will be reflected in the element though the reverse is not the case.
[中]返回此元素声明的所有名称空间。如果没有为此元素声明名称空间,则将返回一个空列表。列表由元素支持,因此列表的更改将反映在元素中,尽管情况并非相反。

代码示例

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

HashSet prefixes = new HashSet();
for ( Element context = element; context != null; context = context.getParent() ) {
  List declaredNS = new ArrayList(context.declaredNamespaces());
  declaredNS.add(context.getNamespace());

代码示例来源:origin: pentaho/pentaho-kettle

public void prepareNSMap( Element l ) {
 @SuppressWarnings( "unchecked" )
 List<Namespace> namespacesList = l.declaredNamespaces();
 for ( Namespace ns : namespacesList ) {
  if ( ns.getPrefix().trim().length() == 0 ) {
   data.NAMESPACE.put( "pre" + data.NSPath.size(), ns.getURI() );
   String path = "";
   Element element = l;
   while ( element != null ) {
    if ( element.getNamespacePrefix() != null && element.getNamespacePrefix().length() > 0 ) {
     path = GetXMLDataMeta.N0DE_SEPARATOR + element.getNamespacePrefix() + ":" + element.getName() + path;
    } else {
     path = GetXMLDataMeta.N0DE_SEPARATOR + element.getName() + path;
    }
    element = element.getParent();
   }
   data.NSPath.add( path );
  } else {
   data.NAMESPACE.put( ns.getPrefix(), ns.getURI() );
  }
 }
 @SuppressWarnings( "unchecked" )
 List<Element> elementsList = l.elements();
 for ( Element e : elementsList ) {
  prepareNSMap( e );
 }
}

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

/**
 * Writes all namespaces declared directly on element.
 *
 * @throws IOException
 */
protected void writeNamespaces(Element element) throws IOException {
  assert element != null;
  for (Namespace ns : element.declaredNamespaces()) {
    writeNamespace(ns);
    namespaceStack.push(ns);
  }
}

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

/**
 * Constructs a STAX {@link EndElement}event from a DOM4J {@link Element}.
 * 
 * @param elem
 *            The {@link Element}from which to construct the event.
 * 
 * @return The newly constructed {@link EndElement}event.
 */
public EndElement createEndElement(Element elem) {
  QName tagName = createQName(elem.getQName());
  Iterator<javax.xml.stream.events.Namespace> nsIter = new NamespaceIterator(elem.declaredNamespaces()
      .iterator());
  return factory.createEndElement(tagName, nsIter);
}

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

/**
 * Constructs a STAX {@link StartElement}event from a DOM4J {@link
 * Element}.
 * 
 * @param elem
 *            The {@link Element}from which to construct the event.
 * 
 * @return The newly constructed {@link StartElement}event.
 */
public StartElement createStartElement(Element elem) {
  // create name
  QName tagName = createQName(elem.getQName());
  // create attribute & namespace iterators
  Iterator<javax.xml.stream.events.Attribute> attrIter = new AttributeIterator(elem.attributeIterator());
  Iterator<javax.xml.stream.events.Namespace> nsIter = new NamespaceIterator(elem.declaredNamespaces()
      .iterator());
  // create start event
  return factory.createStartElement(tagName, attrIter, nsIter);
}

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

List<Namespace> nsToBeRemoved = createLinkedList();
for (Iterator<?> i = element.declaredNamespaces().iterator(); i.hasNext(); ) {
  Namespace ns = (Namespace) i.next();
  String schemaLocation = null;
  for (Iterator<?> i = element.declaredNamespaces().iterator(); i.hasNext(); ) {
    Namespace ns = (Namespace) i.next();

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

List<Namespace> nsToBeRemoved = createLinkedList();
for (Iterator<?> i = element.declaredNamespaces().iterator(); i.hasNext(); ) {
  Namespace ns = (Namespace) i.next();
  String schemaLocation = null;
  for (Iterator<?> i = element.declaredNamespaces().iterator(); i.hasNext(); ) {
    Namespace ns = (Namespace) i.next();

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

List<Namespace> nsToBeRemoved = createLinkedList();
for (Iterator<?> i = element.declaredNamespaces().iterator(); i.hasNext(); ) {
  Namespace ns = (Namespace) i.next();
  String schemaLocation = null;
  for (Iterator<?> i = element.declaredNamespaces().iterator(); i.hasNext(); ) {
    Namespace ns = (Namespace) i.next();

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

for (Object ns : dom4jElement.declaredNamespaces()) {
  String name = ((Namespace) ns).getPrefix();
  String value = ((Namespace) ns).getURI();

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

List<Namespace> declaredNamespaces = element.declaredNamespaces();

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

for (Object ns : dom4jElement.declaredNamespaces()) {
  String name = ((Namespace) ns).getPrefix();
  String value = ((Namespace) ns).getURI();

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

public List declaredNamespaces() {
  return element.declaredNamespaces();
}

代码示例来源:origin: jboss.jboss-embeddable-ejb3/hibernate-all

public List declaredNamespaces() {
  return element.declaredNamespaces();
}

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

List<Namespace> declaredNamespaces = element.declaredNamespaces();

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

public List declaredNamespaces() {
  return target().declaredNamespaces();
}

代码示例来源:origin: jboss.jboss-embeddable-ejb3/hibernate-all

public List declaredNamespaces() {
  return target().declaredNamespaces();
}

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

/**
 * Writes all namespaces declared directly on element.
 *
 * @throws IOException
 */
protected void writeNamespaces(Element element) throws IOException {
  assert element != null;
  for (Namespace ns : element.declaredNamespaces()) {
    writeNamespace(ns);
    namespaceStack.push(ns);
  }
}

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

/**
 * Writes all namespaces declared directly on element.
 *
 * @throws IOException
 */
protected void writeNamespaces(Element element) throws IOException {
  assert element != null;
  for (Namespace ns : element.declaredNamespaces()) {
    writeNamespace(ns);
    namespaceStack.push(ns);
  }
}

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

/**
 * Constructs a STAX {@link EndElement}event from a DOM4J {@link Element}.
 * 
 * @param elem
 *            The {@link Element}from which to construct the event.
 * 
 * @return The newly constructed {@link EndElement}event.
 */
public EndElement createEndElement(Element elem) {
  QName tagName = createQName(elem.getQName());
  Iterator<javax.xml.stream.events.Namespace> nsIter = new NamespaceIterator(elem.declaredNamespaces()
      .iterator());
  return factory.createEndElement(tagName, nsIter);
}

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

/**
 * Constructs a STAX {@link EndElement}event from a DOM4J {@link Element}.
 * 
 * @param elem
 *            The {@link Element}from which to construct the event.
 * 
 * @return The newly constructed {@link EndElement}event.
 */
public EndElement createEndElement(Element elem) {
  QName tagName = createQName(elem.getQName());
  Iterator nsIter = new NamespaceIterator(elem.declaredNamespaces()
      .iterator());
  return factory.createEndElement(tagName, nsIter);
}

相关文章

微信公众号

最新文章

更多

Element类方法