Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import org.w3c.dom.*;

public class Main {
    /**
     * Add literal text to the supplied element.
     * @param element Target DOM Element.
     * @param literalText Literal text to be added.
     * @return if true all the operation are done. 
     */
    public static boolean addLiteral(Element element, String literalText) {
        try {
            Document document = element.getOwnerDocument();
            Text literal = document.createTextNode(literalText);
            element.appendChild(literal);
            return true;
        } catch (Exception e) {
            return false;
        }
    }
}