@Test public void testFindSingleInstance() throws ManipulationException, XPathExpressionException { Document doc = xmlIO.parseXML( xmlFile ); XPath xPath = XPathFactory.newInstance().newXPath(); NodeList nodeList = (NodeList) xPath.evaluate( " assertTrue( nodeList.getLength() != 0 ); }
public Document parseXML ( final File xmlFile) throws ManipulationException { if ( xmlFile == null || !xmlFile.exists() ) { logger.error( "Unable to locate XML File {} ", xmlFile ); throw new ManipulationException( "XML file ({}) not found.", xmlFile); } Document doc; try { doc = builder.parse( xmlFile); } catch ( SAXException | IOException e ) { logger.error( "Unable to parse XML File", e ); throw new ManipulationException( "Unable to parse XML File", e ); } return doc; }
XMLIO { public Document parseXML ( final File xmlFile) throws ManipulationException { if ( xmlFile == null || !xmlFile.exists() ) { logger.error( "Unable to locate XML File {} ", xmlFile ); throw new ManipulationException( "XML file ({}) not found.", xmlFile); } Document doc; try { doc = builder.parse( xmlFile); } catch ( SAXException | IOException e ) { logger.error( "Unable to parse XML File", e ); throw new ManipulationException( "Unable to parse XML File", e ); } return doc; } }
XMLIO { public Document parseXML ( final File xmlFile) throws ManipulationException { if ( xmlFile == null || !xmlFile.exists() ) { logger.error( "Unable to locate XML File {} ", xmlFile ); throw new ManipulationException( "XML file ({}) not found.", xmlFile); } Document doc; try { doc = builder.parse( xmlFile); } catch ( SAXException | IOException e ) { logger.error( "Unable to parse XML File", e ); throw new ManipulationException( "Unable to parse XML File", e ); } return doc; } XMLIO(); }
XMLIO { public Document parseXML ( final File xmlFile) throws ManipulationException { if ( xmlFile == null || !xmlFile.exists() ) { logger.error( "Unable to locate XML File {} ", xmlFile ); throw new ManipulationException( "XML file ({}) not found.", xmlFile); } Document doc; try { doc = builder.parse( xmlFile); } catch ( SAXException | IOException e ) { logger.error( "Unable to parse XML File", e ); throw new ManipulationException( "Unable to parse XML File", e ); } return doc; } XMLIO(); Document parseXML( final File xmlFile); void writeXML(File target, Document contents); String convert( Document contents ); }
XMLIO { public Document parseXML ( final File xmlFile) throws ManipulationException { if ( xmlFile == null || !xmlFile.exists() ) { logger.error( "Unable to locate XML File {} ", xmlFile ); throw new ManipulationException( "XML file ({}) not found.", xmlFile); } Document doc; try { doc = builder.parse( xmlFile); } catch ( SAXException | IOException e ) { logger.error( "Unable to parse XML File", e ); throw new ManipulationException( "Unable to parse XML File", e ); } return doc; } XMLIO(); Document parseXML( final File xmlFile); void writeXML(File target, Document contents); String convert( Document contents );  }