本文整理匯總了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());
}
}