Examples of generating XML via com-hfg objects.

The XML classes in the com-hfg library are designed to let you construct or parse xml content in a modular, object-oriented way. The XMLTag class is the base tag for the HTML and SVG classes.

  1. Hello World

Example 1: Hello World

      XMLTag tag = new XMLTag("TagOne");
      tag.setAttribute("foo", "bar");
      tag.addContent("Hello World");
      tag.addSubtag(new XMLTag("TagTwo"));

      System.out.println(tag.toXML());
would produce the following XML snippet:
<TagOne foo='bar'>Hello World<TagTwo /></TagOne>

Return to Main Page