Example usage for org.dom4j Branch addElement

List of usage examples for org.dom4j Branch addElement

Introduction

In this page you can find the example usage for org.dom4j Branch addElement.

Prototype

Element addElement(QName qname);

Source Link

Document

Adds a new Element node with the given QName to this branch and returns a reference to the new node.

Usage

From source file:com.vicutu.commons.config.support.LicenseDescriptor.java

License:Open Source License

public void buildElement(Branch parent) throws Exception {
    Element rootElement = parent.addElement("license");
    XmlUtils.addElement(rootElement, "id", id);
    XmlUtils.addElement(rootElement, "product", product);
    XmlUtils.addElement(rootElement, "type", type);
    XmlUtils.addElement(rootElement, "company", company);
    XmlUtils.addElement(rootElement, "version", version);
    XmlUtils.addElement(rootElement, "mac", mac);
    XmlUtils.addElement(rootElement, "address", address);
    XmlUtils.addElement(rootElement, "expiresDate", expiresDate);
    XmlUtils.addElement(rootElement, "creationDate", creationDate);
    XmlUtils.addElement(rootElement, "licenseSignature", licenseSignature);
    XmlUtils.addElement(rootElement, "classSignature", classSignature);
    XmlUtils.addElement(rootElement, "publicKey", publicKey);
}

From source file:com.xebia.mojo.dashboard.DashboardMojo.java

License:Apache License

private Element newRow(Branch dashboardTable, String header) {
    Element firstRow = dashboardTable.addElement("tr");
    createTableHeaderCell(firstRow, header, 1);

    return firstRow;
}

From source file:com.xebia.mojo.dashboard.DashboardMojo.java

License:Apache License

private void createProjectRow(Branch dashboardTable, final MavenProject subProject, int rowNum)
        throws MojoExecutionException {
    final Element tableRow = dashboardTable.addElement("tr");
    String cssClass = (rowNum == 0) ? "a" : "b";
    tableRow.addAttribute("class", cssClass);
    createProjectNameCell(subProject, tableRow);
    doWithReports(new ReportColumnCallback() {
        public void handleReportColumn(DashboardReport report, String col) throws MojoExecutionException {
            if (report.canExecute(subProject)) {
                Node node = report.getContent(subProject, col);

                if (node != null) {
                    Node content = node.detach();
                    Element cell = createTableCell(tableRow, null);
                    String href = report.getLinkLocation();

                    if (href != null) {
                        createLink(cell, DashboardUtil.determineCompletePath(subProject) + href, content);
                    } else {
                        cell.add(content);
                    }/*from w w  w. j  a  v  a2s.  co m*/
                } else {
                    createTableCell(tableRow, "-");
                }
            } else {
                createTableCell(tableRow, "-");
            }
        }
    });
}

From source file:com.xebia.mojo.dashboard.DashboardMojo.java

License:Apache License

private Element createTablePart(Branch tableRow, String type, String content) {
    Element element = tableRow.addElement(type);

    if (content != null) {
        element.setText(content);/*from   w  w  w.j  a v a 2s.c o m*/
    }

    return element;
}

From source file:com.xebia.mojo.dashboard.DashboardMojo.java

License:Apache License

private void createLink(Branch parent, String href, Node content) {
    Element link = parent.addElement("a");
    link.add(content);/* w  w w .  j a  va  2 s. c om*/
    link.addAttribute("href", href);
}

From source file:com.xebia.mojo.dashboard.DashboardMojo.java

License:Apache License

private void createLink(Branch parent, String href, String content) {
    Element link = parent.addElement("a");
    link.setText(content);/*ww  w.  j  a va 2s. c  om*/
    link.addAttribute("href", href);
}

From source file:edu.ucsd.library.dams.api.DAMSAPIServlet.java

private static Element addElement(Branch parent, String elemName, Namespace ns) {
    return parent.addElement(new QName(elemName, ns));
}

From source file:edu.umd.cs.findbugs.xml.Dom4JXMLOutput.java

License:Open Source License

@Override
public void openTag(String tagName) {
    Branch top = stack.getLast();
    Element element = top.addElement(tagName);
    stack.addLast(element);/*from   w  ww  . j av a  2s.  co m*/
}

From source file:edu.umd.cs.findbugs.xml.Dom4JXMLOutput.java

License:Open Source License

@Override
public void openTag(String tagName, XMLAttributeList attributeList) {
    Branch top = stack.getLast();
    Element element = top.addElement(tagName);
    stack.addLast(element);/*from w w w .ja v a2s .com*/

    for (Iterator<XMLAttributeList.NameValuePair> i = attributeList.iterator(); i.hasNext();) {
        XMLAttributeList.NameValuePair pair = i.next();
        element.addAttribute(pair.getName(), pair.getValue());
    }
}

From source file:edu.umd.cs.findbugs.xml.Dom4JXMLOutput.java

License:Open Source License

@Override
public void startTag(String tagName) {
    Branch top = stack.getLast();
    Element element = top.addElement(tagName);
    stack.addLast(element);//from  w  ww.ja  v  a 2s.  c o m
}