public void endElement(String uri, String localName, String qName) throws SAXException { // boolean recognizedFlag = false; String data = dataBuffer.toString(); if (qName.equals("MedlineCitationSet")) { } /** ** ELEMENT MedlineCitation begins *** */ else if (qName.equals("MedlineCitation")) { bool_medlineCitation = false; try { String bionix_articleTitle = ""; String bionix_abstract_txt = ""; File file_bionix = new File(directory_bionix + "/" + pmid.trim() + ".txt"); if (!file_bionix.exists()) { System.out.println(file_bionix.getCanonicalPath() + " not reaadable"); System.exit(0); } if (!file_bionix.canRead()) { System.out.println(file_bionix.getCanonicalPath() + " not reaadable"); System.exit(0); } FileInputStream fis = new FileInputStream(file_bionix); InputStreamReader isr = new InputStreamReader(fis); BufferedReader br = new BufferedReader(isr); String tmp_tmp; boolean bool_tmp_abs = false; while ((tmp_tmp = br.readLine()) != null) { if (bool_tmp_abs == true && tmp_tmp.trim().length() > 0) bionix_abstract_txt = bionix_abstract_txt + tmp_tmp; if (tmp_tmp.startsWith("AB")) bionix_abstract_txt = tmp_tmp.substring(4, tmp_tmp .length()); if (tmp_tmp.startsWith("TI")) { int tmp_place; tmp_place = tmp_tmp.indexOf("AB"); if (tmp_place == -1) bionix_articleTitle = tmp_tmp.substring(4, tmp_tmp .length()); else { bool_tmp_abs = true; bionix_articleTitle = tmp_tmp.substring(4, tmp_place); bionix_abstract_txt = tmp_tmp.substring( tmp_place + 4, tmp_tmp.length()); } } if (tmp_tmp.startsWith("AU")) bool_tmp_abs = false; } bionix_abstract_txt.trim(); bionix_articleTitle.trim(); File file = new File(directory_write_txt + "/" + pmid + ".txt"); FileOutputStream fos = new FileOutputStream(file); PrintStream ps = new PrintStream(fos); ps.println("pmid - " + pmid); ps.println("owner - " + owner); if (status.length() > 0) ps.println("status - " + status); ps.println("dateCreated - " + dateCreated); if (pubModel.length() > 0) ps.println("pumModel - " + pubModel); if (dateCompleted.length() > 0) ps.println("dateCompleted - " + dateCompleted); if (dateCreated.length() > 0) ps.println("dateRevised - " + dateRevised); ps.println("datepubDate - " + datepubDate); ps.println("datepubDate_display - " + datepubDate_display); if (issn.length() >= 1) ps.println("issn - " + issn); if (volume.length() >= 1) ps.println("volume - " + volume); if (issue.length() >= 1) ps.println("issue - " + issue); if (coden.length() >= 1) ps.println("coden - " + coden); if (title.length() >= 1) ps.println("title - " + title); if (iso.length() >= 1) ps.println("iso - " + iso); if (medlinePgn.length() >= 1) ps.println("medlinePgn - " + medlinePgn); if (chemicalList.length() > 0) ps.println("chemicalList - " + chemicalList); if (publicationTitleList.length() > 0) ps .println("publicationTitleList - " + publicationTitleList); if (dataBankList.length() > 0) ps.println("dataBankList - " + dataBankList); if (grantList.length() > 0) ps.println("grantList - " + grantList); if (personalNameSubList.length() > 0) ps.println("personalNameSubList - " + personalNameSubList); ps.println("citationSubset - " + citationSubset); if (commentOn.length() > 0) ps.println("CommentOn - " + commentOn); if (commentIn.length() > 0) ps.println("commentIn - " + commentIn); if (erratumIn.length() > 0) ps.println("erratumIn - " + erratumIn); if (erratumFor.length() > 0) ps.println("erratumFor - " + erratumFor); if (repFrom.length() > 0) ps.println("repFrom - " + repFrom); if (repIn.length() > 0) ps.println("repIn - " + repIn); if (retOf.length() > 0) ps.println("retOf - " + retOf); if (retIn.length() > 0) ps.println("retIn - " + retIn); if (summPatIn.length() > 0) ps.println("summPatIn - " + summPatIn); if (orgRepIn.length() > 0) ps.println("orgRepIn - " + orgRepIn); if (spaceFlightMission.length() > 0) ps.println("spaceFlightMission - " + spaceFlightMission); if (geneSymbolList.length() > 0) ps.println("geneSymbolList - " + geneSymbolList); if (numberofRef.length() > 0) ps.println("numberofRef - " + numberofRef); if (otherID.length() > 0) ps.println("otherID - " + otherID); if (generalNote.length() > 0) ps.println("generalNote - " + generalNote); if (country.length() > 0) ps.println("country - " + country); if (medlineTA.length() > 0) ps.println("medlineTA - " + medlineTA); if (medlineCode.length() > 0) ps.println("medlineCode - " + medlineCode); if (nlmUniqueID.length() > 0) ps.println("nlmUniqueID - " + nlmUniqueID); if (articleTitle.length() > 0) ps.println("articleTitle - " + articleTitle); if (bionix_articleTitle.length() > 0) ps.println("bionix_articleTitle - " + bionix_articleTitle); if (abstract_txt.length() > 0) ps.println("abstract_txt - " + abstract_txt); if (bionix_abstract_txt.length() > 0) ps.println("bionix_abstract_txt - " + bionix_abstract_txt); if (copyright.length() > 0) ps.println("copyright - " + copyright); if (affiliation.length() > 0) ps.println("affiliation - " + affiliation); if (authorList.length() > 0) ps.println("authorList - " + authorList); if (language.length() > 0) ps.println("language - " + language); if (meshHeadingList.length() > 0) ps.println("meshHeadingList - " + meshHeadingList); if (vernacularTitle.length() > 0) ps.println("vernacularTitle - " + vernacularTitle); if (investigatorList.length() > 0) ps.println("investigatorList - " + investigatorList); if (articleDate.length() > 0) ps.println("articleDate - " + articleDate); if (keywordOwner.length() > 0) ps.println("keywordOwner- " + keywordOwner); if (keywordList.length() > 0) ps.println("keywordList - " + keywordList); source = medlineTA + ". " + datepubDate_display + ";"; if (volume.trim().length() > 0) source = source + volume; if (issue.length() > 0) source = source + "(" + issue + ")"; source = source + ":" + medlinePgn + "."; ps.println("source - " + source); if (publicationStatus.length() > 0) ps.println("publicationStatus - " + publicationStatus); if (articleIdList.length() > 0) ps.println("articleIdList - " + articleIdList); if (edat.length() > 0) ps.println("edat - " + edat); if (mhda.length() > 0) ps.println("mhda - " + mhda); System.out.println(" Writing " + file.getCanonicalPath()); } catch (Exception e_file) { e_file.printStackTrace(); } }