@Test public void testParseBook() { try { testStream = PubMedXMLParserTest.class.getResourceAsStream( "/data/pubmed-fullbook.xml" ); Collection<BibliographicReference> brl = testParser.parse( testStream ); BibliographicReference br = brl.iterator().next(); assertNotNull( br ); assertEquals( "21796826", br.getPubAccession().getAccession() ); assertEquals( "Field, Marilyn J; Boat, Thomas F", br.getEditor() ); assertEquals( "Institute of Medicine (US) Committee on Accelerating Rare Diseases Research and Orphan Product Development", br.getAuthorList() ); assertEquals( "Rare Diseases and Orphan Products: Accelerating Research and Development", br.getPublication() ); assertEquals( "Rare Diseases and Orphan Products: Accelerating Research and Development", br.getTitle() ); SimpleDateFormat f = new SimpleDateFormat( "yyyy" ); Date publicationDate = br.getPublicationDate(); assertNotNull( publicationDate ); assertEquals( "2010", f.format( publicationDate ) ); assertTrue( br.getAbstractText() .startsWith( "This Institute of Medicine (IOM) study grew out of discussions" ) ); assertTrue( br.getAbstractText().endsWith( "interested general public." ) ); } 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 );  }