* DOM_Builder_Ex.java
*
*Created by : Kaustubh Verma
www.campusfever.wordpress.com
* Created on March 24, 2008, 3:54 PM
*
* Purpose : To demostrate the instantiation of a DOM builder factory and DOM document
*/
// javax.xml.parsers : Provides classes allowing the processing of XML documents.
// org.w3c.dom :
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.Document;
/**
*
*The Class Definition starts here
*/
public class DOM_Builder_Ex {
/** Creates a new instance of DOM_Builder_Ex */
public DOM_Builder_Ex() {
//
Document document;
DocumentBuilder builder = null;
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
try{
builder = factory.newDocumentBuilder();
document = builder.newDocument();
System.out.println("DOM builder and DOM factory objects instantiated successfully");
}
catch (ParserConfigurationException e)
{
e.printStackTrace();
}
}
//
public static void main(String ...args){
DOM_Builder_Ex dom = new DOM_Builder_Ex();
}
}
No comments:
Post a Comment