本文整理汇总了Java中org.dom4j.tree.DefaultElement.addAttribute方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultElement.addAttribute方法的具体用法?Java DefaultElement.addAttribute怎么用?Java DefaultElement.addAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.dom4j.tree.DefaultElement
的用法示例。
在下文中一共展示了DefaultElement.addAttribute方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildDocument
import org.dom4j.tree.DefaultElement; //导入方法依赖的package包/类
/**
*/
@Override
public void buildDocument(final DefaultElement parent) {
final DefaultElement orgaElement = new DefaultElement(CPCore.ORGANIZATION);
orgaElement.addAttribute(CPCore.IDENTIFIER, identifier);
orgaElement.addAttribute(CPCore.STRUCTURE, structure);
final DefaultElement titleElement = new DefaultElement(CPCore.TITLE);
titleElement.setText(title);
orgaElement.add(titleElement);
if (metadata != null) {
metadata.buildDocument(orgaElement);
}
for (final Iterator<CPItem> itItem = items.iterator(); itItem.hasNext();) {
final CPItem item = itItem.next();
item.buildDocument(orgaElement);
}
parent.add(orgaElement);
}
示例2: endNode
import org.dom4j.tree.DefaultElement; //导入方法依赖的package包/类
public void endNode()
{
try
{
if (!this.children)
{
DefaultElement localDefaultElement = new DefaultElement((String)this.elementStack.pop());
for (int i = 0; i < this.attributes.getLength(); i++)
localDefaultElement.addAttribute(this.attributes.getQName(i), this.attributes.getValue(i));
this.writer.write(localDefaultElement);
this.attributes.clear();
this.children = true;
this.started = true;
return;
}
startElement();
this.writer.endElement("", "", (String)this.elementStack.pop());
return;
}
catch (SAXException localSAXException)
{
throw new StreamException(localSAXException);
}
catch (IOException localIOException)
{
throw new StreamException(localIOException);
}
}
示例3: buildDocument
import org.dom4j.tree.DefaultElement; //导入方法依赖的package包/类
/**
*/
@Override
public void buildDocument(final DefaultElement parent) {
// String base = "";
// if(xmlbase != null && !xmlbase.equals("")) base="
// xml:base=\""+xmlbase+"\"";
// TODO: xml base imlement !!!
final DefaultElement resourceElement = new DefaultElement(CPCore.RESOURCE);
resourceElement.addAttribute(CPCore.IDENTIFIER, identifier);
resourceElement.addAttribute(CPCore.TYPE, type);
resourceElement.addAttribute(CPCore.HREF, href);
if (!xmlbase.equals("")) {
resourceElement.addAttribute(CPCore.BASE, xmlbase);
}
if (metadata != null) {
metadata.buildDocument(resourceElement);
}
// build files
for (final Iterator<CPFile> itFiles = files.iterator(); itFiles.hasNext();) {
final CPFile file = itFiles.next();
file.buildDocument(resourceElement);
}
// build dependencies
for (final Iterator<CPDependency> itDep = dependencies.iterator(); itDep.hasNext();) {
final CPDependency dep = itDep.next();
dep.buildDocument(resourceElement);
}
parent.add(resourceElement);
}
示例4: buildDocument
import org.dom4j.tree.DefaultElement; //导入方法依赖的package包/类
/**
*/
@Override
public void buildDocument(final DefaultElement parent) {
final DefaultElement itemElement = new DefaultElement(CPCore.ITEM);
itemElement.addAttribute(CPCore.IDENTIFIER, identifier);
if (!identifierRef.equals("")) {
itemElement.addAttribute(CPCore.IDENTIFIERREF, identifierRef);
}
itemElement.addAttribute(CPCore.ISVISIBLE, isVisibleString());
if (metadata != null) {
metadata.buildDocument(itemElement);
}
final DefaultElement titleElement = new DefaultElement(CPCore.TITLE);
titleElement.setText(title);
itemElement.add(titleElement);
for (final Iterator<CPItem> itItem = items.iterator(); itItem.hasNext();) {
final CPItem item = itItem.next();
item.buildDocument(itemElement);
}
parent.add(itemElement);
}
示例5: buildDocument
import org.dom4j.tree.DefaultElement; //导入方法依赖的package包/类
/**
*/
@Override
public void buildDocument(final DefaultElement parent) {
final DefaultElement fileElement = new DefaultElement(CPCore.FILE);
fileElement.addAttribute(CPCore.HREF, href);
if (metadata != null) {
metadata.buildDocument(fileElement);
}
parent.add(fileElement);
}
示例6: buildDocument
import org.dom4j.tree.DefaultElement; //导入方法依赖的package包/类
/**
*/
@Override
public void buildDocument(final DefaultElement parent) {
final DefaultElement depElement = new DefaultElement(CPCore.DEPENDENCY);
depElement.addAttribute(CPCore.IDENTIFIERREF, identifierRef);
parent.add(depElement);
}
示例7: createAuthEl
import org.dom4j.tree.DefaultElement; //导入方法依赖的package包/类
private static Element createAuthEl(String name, String authenticationText) {
if (name == null) {
throw new NullPointerException(
"SASL mechanism name shouldn't be null.");
}
DefaultElement authEl = new DefaultElement("auth",
Namespace.get("urn:ietf:params:xml:ns:xmpp-sasl"));
authEl.addAttribute("mechanism", name);
if (authenticationText != null) {
authEl.setText(authenticationText);
}
return authEl;
}