Java tutorial
//package com.java2s; /* * Copyright (C) 2014 The MANO Authors. * All rights reserved. Use is subject to license terms. * * See more http://mano.diosay.com/ * */ import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.xpath.XPath; import javax.xml.xpath.XPathFactory; public class Main { static DocumentBuilderFactory _factory; static DocumentBuilder _builder; static XPath _xpath; static void init() throws ParserConfigurationException { if (_factory == null) { _factory = DocumentBuilderFactory.newInstance(); _factory.setNamespaceAware(false); } if (_xpath == null) { _xpath = XPathFactory.newInstance().newXPath(); } if (_builder == null) { _builder = _factory.newDocumentBuilder(); } } }