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

Java
import com.chilkatsoft.*;

public class ChilkatExample {

  static {
    try {
        System.loadLibrary("chilkat");
    } catch (UnsatisfiedLinkError e) {
      System.err.println("Native code library failed to load.\n" + e);
      System.exit(1);
    }
  }

  public static void main(String argv[])
  {
    CkXml xml = new CkXml();

    xml.put_Tag("abc");
    xml.put_Content("123");

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