org.dom4j.Attribute.getNamespacePrefix()方法的使用及代码示例

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

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

Attribute.getNamespacePrefix介绍

[英]Returns the namespace prefix of this element if one exists otherwise an empty String is returned.
[中]返回此元素的命名空间前缀(如果存在),否则返回空String

代码示例

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

@Override
String getNamespacePrefix(Object node) {
  if (node instanceof Element) {
    return ((Element) node).getNamespacePrefix();
  }
  if (node instanceof Attribute) {
    return ((Attribute) node).getNamespacePrefix();
  }
  return null;
}

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

/**
 * Determines if element is a special case of XML elements
 * where it contains an xml:space attribute of "preserve".
 * If it does, then retain whitespace.
 */
protected final boolean isElementSpacePreserved(Element element) {
 final Attribute attr = element.attribute("space");
 boolean preserveFound=preserve; //default to global state
 if (attr!=null) {
  if ("xml".equals(attr.getNamespacePrefix()) &&
    "preserve".equals(attr.getText())) {
   preserveFound = true;
  }
  else {
   preserveFound = false;
  }
 }
 return preserveFound;
}
/** Outputs the content of the given element. If whitespace trimming is

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

public String getAttributePrefix(int index) {
  if (element != null) {
    Attribute attribute = element.attribute(index);
    if (attribute != null) {
      String prefix = attribute.getNamespacePrefix();
      if ((prefix != null) && (prefix.length() > 0)) {
        return prefix;
      }
    }
  }
  return null;
}

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

public boolean isAttributeNamespaceDeclaration(int index) {
  if (element != null) {
    Attribute attribute = element.attribute(index);
    if (attribute != null) {
      return "xmlns".equals(attribute.getNamespacePrefix());
    }
  }
  return false;
}

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

/**
 * Determines if element is a special case of XML elements where it contains
 * an xml:space attribute of "preserve". If it does, then retain whitespace.
 * 
 * @param element
 *            DOCUMENT ME!
 * 
 * @return DOCUMENT ME!
 */
protected final boolean isElementSpacePreserved(Element element) {
  final Attribute attr = (Attribute) element.attribute("space");
  boolean preserveFound = preserve; // default to global state
  if (attr != null) {
    preserveFound = "xml".equals(attr.getNamespacePrefix()) && "preserve".equals(attr.getText());
  }
  return preserveFound;
}

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

public boolean isAttributeNamespaceDeclaration(int index) {
  if (element != null) {
    Attribute attribute = element.attribute(index);
    if (attribute != null) {
      return "xmlns".equals(attribute.getNamespacePrefix());
    }
  }
  return false;
}

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

public String getAttributePrefix(int index) {
  if (element != null) {
    Attribute attribute = element.attribute(index);
    if (attribute != null) {
      String prefix = attribute.getNamespacePrefix();
      if ((prefix != null) && (prefix.length() > 0)) {
        return prefix;
      }
    }
  }
  return null;
}

代码示例来源:origin: org.freemarker/freemarker-gae

@Override
String getNamespacePrefix(Object node) {
  if (node instanceof Element) {
    return ((Element) node).getNamespacePrefix();
  }
  if (node instanceof Attribute) {
    return ((Attribute) node).getNamespacePrefix();
  }
  return null;
}

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

public String getAttributePrefix(int index) {
  if (element != null) {
    Attribute attribute = element.attribute(index);
    if (attribute != null) {
      String prefix = attribute.getNamespacePrefix();
      if ((prefix != null) && (prefix.length() > 0)) {
        return prefix;
      }
    }
  }
  return null;
}

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

public boolean isAttributeNamespaceDeclaration(int index) {
  if (element != null) {
    Attribute attribute = element.attribute(index);
    if (attribute != null) {
      return "xmlns".equals(attribute.getNamespacePrefix());
    }
  }
  return false;
}

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

public boolean isAttributeNamespaceDeclaration(int index) {
  if (element != null) {
    Attribute attribute = element.attribute(index);
    if (attribute != null) {
      return "xmlns".equals(attribute.getNamespacePrefix());
    }
  }
  return false;
}

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

public String getAttributePrefix(int index) {
  if (element != null) {
    Attribute attribute = element.attribute(index);
    if (attribute != null) {
      String prefix = attribute.getNamespacePrefix();
      if ((prefix != null) && (prefix.length() > 0)) {
        return prefix;
      }
    }
  }
  return null;
}

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

@Override
String getNamespacePrefix(Object node) {
  if (node instanceof Element) {
    return ((Element) node).getNamespacePrefix();
  }
  if (node instanceof Attribute) {
    return ((Attribute) node).getNamespacePrefix();
  }
  return null;
}

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

public boolean isAttributeNamespaceDeclaration(int index) {
  if (element != null) {
    Attribute attribute = element.attribute(index);
    if (attribute != null) {
      return "xmlns".equals(attribute.getNamespacePrefix());
    }
  }
  return false;
}

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

public String getAttributePrefix(int index) {
  if (element != null) {
    Attribute attribute = element.attribute(index);
    if (attribute != null) {
      String prefix = attribute.getNamespacePrefix();
      if ((prefix != null) && (prefix.length() > 0)) {
        return prefix;
      }
    }
  }
  return null;
}

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

public String getAttributePrefix(int index) {
  if (element != null) {
    Attribute attribute = element.attribute(index);
    if (attribute != null) {
      String prefix = attribute.getNamespacePrefix();
      if ((prefix != null) && (prefix.length() > 0)) {
        return prefix;
      }
    }
  }
  return null;
}

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

public boolean isAttributeNamespaceDeclaration(int index) {
  if (element != null) {
    Attribute attribute = element.attribute(index);
    if (attribute != null) {
      return "xmlns".equals(attribute.getNamespacePrefix());
    }
  }
  return false;
}

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

String getNamespacePrefix(Object node) {
  if(node instanceof Element) {
    return ((Element)node).getNamespacePrefix();
  }
  if(node instanceof Attribute) {
    return ((Attribute)node).getNamespacePrefix();
  }
  return null;
}

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

public String getAttributePrefix(int index) {
  if (element != null) {
    Attribute attribute = element.attribute(index);
    if (attribute != null) {
      String prefix = attribute.getNamespacePrefix();
      if ((prefix != null) && (prefix.length() > 0)) {
        return prefix;
      }
    }
  }
  return null;
}

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

public String getAttributePrefix(int index) {
  if (element != null) {
    Attribute attribute = element.attribute(index);
    if (attribute != null) {
      String prefix = attribute.getNamespacePrefix();
      if ((prefix != null) && (prefix.length() > 0)) {
        return prefix;
      }
    }
  }
  return null;
}

相关文章