本文整理了Java中org.jdom.Attribute.setAttributeType()
方法的一些代码示例,展示了Attribute.setAttributeType()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Attribute.setAttributeType()
方法的具体详情如下:
包路径:org.jdom.Attribute
类名称:Attribute
方法名:setAttributeType
[英]This will set the type of the Attribute
.
[中]这将设置Attribute
的类型。
代码示例来源:origin: org.jdom/jdom-legacy
/**
* This will create a new <code>Attribute</code> with the
* specified (local) name, value, and type, and in the provided
* <code>{@link Namespace}</code>.
*
* @param name <code>String</code> name of <code>Attribute</code>.
* @param value <code>String</code> value for new attribute.
* @param type <code>int</code> type for new attribute.
* @param namespace <code>Namespace</code> namespace for new attribute.
* @throws IllegalNameException if the given name is illegal as an
* attribute name or if if the new namespace is the default
* namespace. Attributes cannot be in a default namespace.
* @throws IllegalDataException if the given attribute value is
* illegal character data (as determined by
* {@link org.jdom.Verifier#checkCharacterData}) or
* if the given attribute type is not one of the
* supported types.
*/
public Attribute(final String name, final String value, final int type, final Namespace namespace) {
setName(name);
setValue(value);
setAttributeType(type);
setNamespace(namespace);
}
代码示例来源:origin: org.jdom/jdom-contrib
public Attribute setAttributeType(int type) {
int oldType = this.getAttributeType();
if (type != oldType) {
super.setAttributeType(type);
// Udpate the owning document's lookup table.
Document doc = this.getDocument();
if (doc instanceof IdDocument) {
if (oldType == Attribute.ID_TYPE) {
((IdDocument)doc).removeId(this.getValue());
}
if (type == Attribute.ID_TYPE) {
((IdDocument)doc).addId(this.getValue(), this.getParent());
}
}
}
return this;
}
}
内容来源于网络,如有侵权,请联系作者删除!