package xmldom;

import java.io.File;

import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;

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

public class XPath {
	public static void main(String[] args) throws Exception {
		Document dom = DocumentBuilderFactory
				.newInstance()
				.newDocumentBuilder()
				.parse(new File("/home/panitz/neuesSkript.xml"));
		var xp =XPathFactory
		.newInstance()
		.newXPath()
		.compile("following::node()");
		var result = xp.evaluate(dom.getDocumentElement().getChildNodes().item(2), XPathConstants.NODESET);
		var vor =(NodeList)result;
		System.out.println(vor.getLength());
	}
	
}
