Java tutorial
//package com.java2s; /*********************************************************************************************************************** * Copyright (c) 2008 empolis GmbH and brox IT Solutions GmbH. All rights reserved. This program and the accompanying * materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html * * Contributors: Ivan Churkin (brox IT Solutions GmbH) - initial creator * Sebastian Voigt (brox IT Solutions GmbH) * Andreas Weber (empolis GmbH) - switch to XML 1.1 in header to make more documents readable. **********************************************************************************************************************/ import org.w3c.dom.Node; import org.w3c.dom.Text; public class Main { /** * Creates the text. * * @param parent * the parent * @param text * the text * * @return the text */ public static Text createText(final Node parent, final String text) { final Text child = parent.getOwnerDocument().createTextNode(text); parent.appendChild(child); return child; } }