view src/test/java/jungle/misc/fj/XMLNodeTest.java @ 8:abed5bd92fcb

commit
author shoshi <shoshi@cr.ie.u-ryukyu.ac.jp>
date Tue, 03 Jul 2012 18:59:28 +0900
parents c3c65308a11b
children
line wrap: on
line source

package jungle.misc.fj;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;

import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;

public class XMLNodeTest
{
	public static void main(String _args[]) throws Exception
	{
		DocumentBuilder b = DocumentBuilderFactory.newInstance().newDocumentBuilder();
		Document g = b.newDocument();
		
		Element e = g.createElement("hoge");
		g.appendChild(e);
		e.appendChild(g.createElement("hoge"));
		NodeList l1 = e.getElementsByTagName("hoge");
		System.out.println(l1.getLength());
		e.appendChild(g.createElement("hoge"));
		e.appendChild(g.createElement("hoge"));
		NodeList l2 = e.getElementsByTagName("hoge");
		
		System.out.println(l1.getLength());
		System.out.println(l2.getLength());
	}
}