Sample code for 30+ languages & platforms
Java

Setting XML Tag and Content

See more XML Examples

Demonstrates how to set the tag and content of an XML node.

The following XML sample code produces this output:


<abc>123</abc>

Chilkat Java Downloads

Chilkat2 Java
import com.chilkatsoft.chilkat2.Xml;

public class ChilkatExample {

    public static void main(String[] args) {
        Xml xml = new Xml();

        xml.setTag("abc");
        xml.setContent("123");

        System.out.println(xml.getXml());
    }
}