Code example for DocumentBuilder

Methods: newDocumentparse

0
 
		try { 
			builder = factory.newDocumentBuilder();
			File f = new File(fname);
			if (f.exists()) {
				doc = builder.parse(f);
			} 
			 
		} catch (Exception e) {
			e.printStackTrace();
		} 
 
		try { 
			if (null == doc)
			{ 
				Util.Trace("Configuration.load file not loaded"+fname);
				doc = builder.newDocument();
				Element root = doc.createElement("alter");
				doc.appendChild(root);
				Node comment = doc.createComment("This is a configxml for cnlive");
				root.appendChild(comment);
			} 
Contextual code suggestions in your IDE  Get Codota for Java