@Test public void testParseBookArticle() { try { testStream = PubMedXMLParserTest.class.getResourceAsStream( "/data/pubmed-bookarticle.xml" ); Collection<BibliographicReference> brl = testParser.parse( testStream ); BibliographicReference br = brl.iterator().next(); assertNotNull( br ); assertEquals( "Pagon, Roberta A; Bird, Thomas D; Dolan, Cynthia R; Stephens, Karen", br.getEditor() ); assertEquals( "Kuhlenbaumer, Gregor; Timmerman, Vincent", br.getAuthorList() ); assertEquals( "GeneReviews", br.getPublication() ); assertEquals( "Giant Axonal Neuropathy", br.getTitle() ); SimpleDateFormat f = new SimpleDateFormat( "yyyy" ); Date publicationDate = br.getPublicationDate(); assertNotNull( publicationDate ); assertEquals( "2003", f.format( publicationDate ) ); assertTrue( br.getAbstractText() .startsWith( "Giant axonal neuropathy (GAN) is characterized by a severe early-onset" ) ); assertTrue( br.getAbstractText().endsWith( "offering custom prenatal testing if the disease-causing mutations in a family are known." ) ); } 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 );  }