Search in sources :

Example 1 with Text

use of de.pdark.decentxml.Text in project sling by apache.

the class JcrNode method createChild.

protected void createChild(String nodeName, String nodeType, Element domElement, GenericJcrRootFile effectiveUnderlying) {
    if (domElement == null) {
        throw new IllegalArgumentException("domNode must not be null");
    }
    if (effectiveUnderlying == null) {
        throw new IllegalArgumentException("effectiveUnderlying must not be null");
    }
    Element element = new Element(nodeName);
    if (nodeType != null) {
        element.addAttribute("jcr:primaryType", nodeType);
    }
    StringBuilder indent = new StringBuilder();
    Element parElement = domElement.getParentElement();
    while (parElement != null) {
        indent.append("    ");
        parElement = parElement.getParentElement();
    }
    domElement.addNode(new Text("\n    " + indent.toString()));
    element = domElement.addNode(element);
    domElement.addNode(new Text("\n" + indent.toString()));
    JcrNode childNode = new JcrNode(this, element, null);
    effectiveUnderlying.save();
}
Also used : Element(de.pdark.decentxml.Element) Text(de.pdark.decentxml.Text)

Aggregations

Element (de.pdark.decentxml.Element)1 Text (de.pdark.decentxml.Text)1