@Test public void testParseMulti() throws Exception { try { testStream = new GZIPInputStream( PubMedXMLParserTest.class.getResourceAsStream( "/data/loader/medline.multi.xml.gz" ) ); Collection<BibliographicReference> brl = testParser.parse( testStream ); assertEquals( 147, brl.size() ); int expectedNumberofKeywords = 258; int expectedNumberofCompounds = 46; int actualNumberofKeywords = 0; int actualNumberofCompounds = 0; for ( BibliographicReference reference : brl ) { assertNotNull( reference.getPublicationDate() ); Collection<Keyword> keywords = reference.getKeywords(); for ( Keyword keyword : keywords ) { assertNotNull( keyword.getTerm() ); actualNumberofKeywords++; } for ( Compound c : reference.getChemicals() ) { assertNotNull( c.getName() ); actualNumberofCompounds++; } } assertEquals( expectedNumberofKeywords, actualNumberofKeywords ); assertEquals( expectedNumberofCompounds, actualNumberofCompounds ); } catch ( RuntimeException e ) { this.logOrThrowException( e ); } }
public Collection<BibliographicReference> parse( InputStream is ) { try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setIgnoringComments( true ); factory.setValidating( false ); builder = factory.newDocumentBuilder(); Document document = builder.parse( is ); PubMedXMLParser.log.debug( "done parsing" ); return this.extractBibRefs( document ); } catch ( IOException | SAXException | ParserConfigurationException e ) { throw new RuntimeException( e ); } }
PubMedXMLParser { public Collection<BibliographicReference> parse( InputStream is ) { try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setIgnoringComments( true ); factory.setValidating( false ); builder = factory.newDocumentBuilder(); Document document = builder.parse( is ); PubMedXMLParser.log.debug( "done parsing" ); return this.extractBibRefs( document ); } catch ( IOException | SAXException | ParserConfigurationException e ) { throw new RuntimeException( e ); } } }
PubMedXMLParser { public Collection<BibliographicReference> parse( InputStream is ) { try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setIgnoringComments( true ); factory.setValidating( false ); builder = factory.newDocumentBuilder(); Document document = builder.parse( is ); PubMedXMLParser.log.debug( "done parsing" ); return this.extractBibRefs( document ); } catch ( IOException | SAXException | ParserConfigurationException e ) { throw new RuntimeException( e ); } }  }
PubMedXMLParser { public Collection<BibliographicReference> parse( InputStream is ) { try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setIgnoringComments( true ); factory.setValidating( false ); builder = factory.newDocumentBuilder(); Document document = builder.parse( is ); PubMedXMLParser.log.debug( "done parsing" ); return this.extractBibRefs( document ); } catch ( IOException | SAXException | ParserConfigurationException e ) { throw new RuntimeException( e ); } }  void extractBookPublicationYear( BibliographicReference bibRef, Node item ); void extractPublisher( BibliographicReference bibRef, Node item ); Collection<BibliographicReference> parse( InputStream is ); }
PubMedXMLParser { public Collection<BibliographicReference> parse( InputStream is ) { try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setIgnoringComments( true ); factory.setValidating( false ); builder = factory.newDocumentBuilder(); Document document = builder.parse( is ); PubMedXMLParser.log.debug( "done parsing" ); return this.extractBibRefs( document ); } catch ( IOException | SAXException | ParserConfigurationException e ) { throw new RuntimeException( e ); } }  void extractBookPublicationYear( BibliographicReference bibRef, Node item ); void extractPublisher( BibliographicReference bibRef, Node item ); Collection<BibliographicReference> parse( InputStream is );  }