Revision 1688 tmp/org.txm.core/src/java/org/txm/scripts/importer/GetAttributeValue.groovy

GetAttributeValue.groovy (revision 1688)
12 12
		String currentpath = "";
13 13
		boolean done = false;
14 14
		
15
		def inputData = null;
16
		def factory = null;
17
		XMLStreamReader parser = null;
15 18
		try {
16 19
			URL url = xmlFile.toURI().toURL();
17
			def inputData = url.openStream();
18
			def factory = XMLInputFactory.newInstance();
19
			XMLStreamReader parser = factory.createXMLStreamReader(inputData);
20
			inputData = url.openStream();
21
			factory = XMLInputFactory.newInstance();
22
			parser = factory.createXMLStreamReader(inputData);
20 23
			for (int event = parser.next(); !done && event != XMLStreamConstants.END_DOCUMENT; event = parser.next())
21 24
			{
22 25
				switch (event) {
......
39 42
					
40 43
				}
41 44
			}
42
			
43 45
		}
44
		catch(Exception e){println("File "+xmlFile+"\n"+e); return "N/A";}
46
		catch(Exception e){println("File "+xmlFile+"\n"+e); 
47
			if (parser != null) parser.close();
48
			if (inputData != null) inputData.close();
49
			return "N/A";}
50
		
51
		if (parser != null) parser.close();
52
		if (inputData != null) inputData.close();
45 53
		return value;
46 54
	}
47 55
}

Also available in: Unified diff