本文整理汇总了Java中org.dom4j.Element.getNamespacePrefix方法的典型用法代码示例。如果您正苦于以下问题:Java Element.getNamespacePrefix方法的具体用法?Java Element.getNamespacePrefix怎么用?Java Element.getNamespacePrefix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.dom4j.Element
的用法示例。
在下文中一共展示了Element.getNamespacePrefix方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isBuiltInType
import org.dom4j.Element; //导入方法依赖的package包/类
/**
* Test if the "type" (or "ref") attribute of the given Schema Element
* designates a built-in datatype, as opposed to a derived type.<p>
*
* An qualified attribute value is determined to be BuiltIn if it has the same
* prefix as the qualified name of the element in which it is defined.<p>
*
* E.g., in the following element, the type is "xs:string", which is a
* built-in type: <xs:element name="artist" type="xs:string"/>.
*
* @param e Description of the Parameter
* @return true if the given schema element refers to a built-in datatype.
*/
private boolean isBuiltInType(Element e) {
String prefix = e.getNamespacePrefix();
String type = e.attributeValue("type", null);
if (type == null) {
type = e.attributeValue("ref", null);
}
if (type == null) {
return false;
}
String typePrefix = NamespaceRegistry.getNamespacePrefix(type);
if (prefix != null && (prefix.equals(typePrefix) || typePrefix.equals("xml"))) {
return true;
}
else {
return false;
}
}
示例2: getBaseRestrictionName
import org.dom4j.Element; //导入方法依赖的package包/类
/**
* Given a restriction element, return the value of the <i>base</i> attribute.
Currently requires
* that a "xsd:" prefix is present in the base attribute, and remove the prefix before returning remainder
* of base attribute.
@see #deriveByRestriction(SimpleType)
*
*@param e Description of the Parameter
*@return The baseName value
*/
private String getBaseRestrictionName(Element e) {
String bn = e.valueOf("@base");
String prefix = e.getNamespacePrefix()+":";
if (!bn.startsWith(prefix)) {
// prtln ("getBaseRestrictionName report");
// prtln ("\tnamespaceURI: " + e.getNamespaceURI());
// return null;
return bn;
}
else {
return bn.substring(prefix.length());
}
}