OKW_XmlReader { public ArrayList<String> getTextContentAsList( String fpsXPathExpression ) { ArrayList<String> lvALReturn = new ArrayList<String>(); try { NodeList myNodeList = (NodeList) myXPath.compile(fpsXPathExpression).evaluate(this.myXMLDocument, XPathConstants.NODESET); int lviCount = myNodeList.getLength(); if (lviCount >= 1) { for( int i = 0; i < lviCount; i++ ) { Node myNode = myNodeList.item(i); lvALReturn.add( myNode.getTextContent() ); } } else { throw new OKWMessageNotFoundException("TextContent not Found!"); } } catch (OKWMessageNotFoundException | XPathExpressionException e) { OKW_HandleException.StopRunning(e, this.getClass()); } return lvALReturn; } OKW_XmlReader(String fpsXMLFile); String getXMLFile(); String getTextContentSingleValue( String fpsXPathExpression ); ArrayList<String> getTextContentAsList( String fpsXPathExpression );  }
@Test public void TC_getTextContentAsList() { try { OKW_XmlReader myXlReader = new OKW_XmlReader("/OKW_XmlReaderTestXML.xml"); ArrayList<String> Actuell = myXlReader.getTextContentAsList(" assertEquals("Ein Wert wird erwartet:", "Wert 1", Actuell.get(0)); assertEquals("Ein Wert wird erwartet:", "Wert 2", Actuell.get(1)); assertEquals("Ein Wert wird erwartet:", "Wert 3", Actuell.get(2)); } catch (JAXBException | ParserConfigurationException | SAXException | IOException e) { fail(e.getMessage()); } }
@Test public void TC_getTextContentAsList_Subfolder() { try { OKW_XmlReader myXlReader = new OKW_XmlReader("/SubFolder4Test/OKW_XmlReaderTestXML2.xml"); ArrayList<String> Actuell = myXlReader.getTextContentAsList(" assertEquals("Ein Wert wird erwartet:", "Wert 1", Actuell.get(0)); assertEquals("Ein Wert wird erwartet:", "Wert 2", Actuell.get(1)); assertEquals("Ein Wert wird erwartet:", "Wert 3", Actuell.get(2)); } catch (JAXBException | ParserConfigurationException | SAXException | IOException e) { fail(e.getMessage()); } }