Utils.java Source code

Java tutorial

Introduction

Here is the source code for Utils.java

Source

import org.w3c.dom.Document;
import org.w3c.dom.Element;

public class Utils {
    /**
     * Add an entity to a specified Element.
     *    (eg <code>DomUtils.addEntity(element, "nbsp");</code>)
     * @param element the containing element
     * @param entity the entity to add
     */
    public static void addEntity(Element element, String entity) {
        element.appendChild(element.getOwnerDocument().createEntityReference(entity));
    }
}