Code example for Node

Methods: getTextContent

0
		DocumentBuilderFactory f = DocumentBuilderFactory.newInstance();
		DocumentBuilder builder = f.newDocumentBuilder();
		Document doc = builder.parse(new File("/home/lukash/dev/2012/FirstOne/src/ru/spbstu/telematics/first/lection8/example.xml"));
		XPath xp = XPathFactory.newInstance().newXPath();
		Node node = (Node) xp.evaluate("/persons/person/age", doc, XPathConstants.NODE);
		System.out.println("person age is: " + node.getTextContent());
	} 
 
 
	private static void saxExample() throws Exception { 
		SAXParser p = SAXParserFactory.newInstance().newSAXParser();
		p.parse(new File("/home/lukash/dev/2012/FirstOne/src/ru/spbstu/telematics/first/lection8/example.xml"), new DefaultHandler() {
 
			@Override 
			public void startElement(String uri, String localName,
					String qName, Attributes attributes) throws SAXException {
				System.out.println("start: " + qName);
			} 
 
			@Override 
			public void endElement(String uri, String localName, String qName)