本文整理汇总了Java中org.dom4j.Branch.addElement方法的典型用法代码示例。如果您正苦于以下问题:Java Branch.addElement方法的具体用法?Java Branch.addElement怎么用?Java Branch.addElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.dom4j.Branch
的用法示例。
在下文中一共展示了Branch.addElement方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toElement
import org.dom4j.Branch; //导入方法依赖的package包/类
/**
* Convert to an XML element.
*/
public Element toElement(Branch parent) {
Element root = parent.addElement("FindBugsSummary");
DateFormat df = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss Z");
Date date = new Date();
root.addAttribute("timestamp", df.format(date));
root.addAttribute("total_classes", String.valueOf(totalClasses));
root.addAttribute("total_bugs", String.valueOf(totalErrors));
root.addAttribute("num_packages", String.valueOf(packageStatsMap.size()));
Iterator<PackageStats> i = packageStatsMap.values().iterator();
while (i.hasNext()) {
PackageStats stats = i.next();
stats.toElement(root);
}
return root;
}
示例2: unmarshallElement
import org.dom4j.Branch; //导入方法依赖的package包/类
private void unmarshallElement(HierarchicalStreamReader reader, Branch branch) {
Element element = branch.addElement(reader.getNodeName());
for (int i=0; i<reader.getAttributeCount(); i++) {
String attributeName = reader.getAttributeName(i);
String attributeValue = reader.getAttribute(i);
element.addAttribute(attributeName, attributeValue);
}
if (StringUtils.isNotBlank(reader.getValue()))
element.setText(reader.getValue().trim());
while (reader.hasMoreChildren()) {
reader.moveDown();
unmarshallElement(reader, element);
reader.moveUp();
}
}
示例3: openTag
import org.dom4j.Branch; //导入方法依赖的package包/类
public void openTag(String tagName, XMLAttributeList attributeList) {
Branch top = stack.getLast();
Element element = top.addElement(tagName);
stack.addLast(element);
for (Iterator<XMLAttributeList.NameValuePair> i= attributeList.iterator();
i.hasNext(); ) {
XMLAttributeList.NameValuePair pair = i.next();
element.addAttribute(pair.getName(), pair.getValue());
}
}
示例4: evaluate
import org.dom4j.Branch; //导入方法依赖的package包/类
public Object evaluate(TaskRequest req, TaskResponse res) {
Branch rslt = new DocumentFactory().createDocument();
if (name != null) {
rslt = rslt.addElement((String) name.evaluate(req, res));
}
return rslt;
}
示例5: openTag
import org.dom4j.Branch; //导入方法依赖的package包/类
public void openTag(String tagName, XMLAttributeList attributeList) {
Branch top = stack.getLast();
Element element = top.addElement(tagName);
stack.addLast(element);
for (Iterator<XMLAttributeList.NameValuePair> i = attributeList.iterator(); i.hasNext();) {
XMLAttributeList.NameValuePair pair = i.next();
element.addAttribute(pair.getName(), pair.getValue());
}
}
示例6: startTag
import org.dom4j.Branch; //导入方法依赖的package包/类
public void startTag(String tagName) {
Branch top = stack.getLast();
Element element = top.addElement(tagName);
stack.addLast(element);
}