View RSS Feed

Java XML

  1. Creating DOM Child Elements

    by , 04-27-2012 at 06:10 PM
    This lesson shows you how to create root and child elements in the DOM tree. We will first create a blank DOM document and add the root element to it. Then I show you how to add comment element and then child element to the root element. In this example following xml code will generated and displayed on the console.
    XML Code:
    <?xml version="1.0" encoding="UTF-8" ?> 
    <!-- This is comment--> 
    <Child attribute1="The value