Package net.sf.jabref.imports

Examples of net.sf.jabref.imports.ParserResult


   *
   * @depends XMPUtilTest.testReadMultiple()
   */
  public void testXMPreadString() throws Exception {

    ParserResult result = BibtexParser.parse(new StringReader(
        "@article{canh05,"
            + "  author = {Crowston, K. and Annabi, H.},\n"
            + "  title = {Title A}}\n" + "@inProceedings{foo,"
            + "  author={Norton Bar}}"));

    Collection<BibtexEntry> c = result.getDatabase().getEntries();
    assertEquals(2, c.size());

    String xmp = XMPUtil.toXMP(c, null);

    /* Test minimal syntaxical completeness */
 
View Full Code Here


  }

  @SuppressWarnings("unchecked")
  public void testReadRawXMP() throws Exception {

    ParserResult result = BibtexParser
        .parse(new StringReader(
            "@article{canh05,"
                + "  author = {Crowston, K. and Annabi, H. and Howison, J. and Masango, C.},\n"
                + "  title = {Effective work practices for floss development: A model and propositions},\n"
                + "  booktitle = {Hawaii International Conference On System Sciences (HICSS)},\n"
                + "  year = {2005},\n"
                + "  owner = {oezbek},\n"
                + "  timestamp = {2006.05.29},\n"
                + "  url = {http://james.howison.name/publications.html}}"));

    Collection c = result.getDatabase().getEntries();
    assertEquals(1, c.size());

    BibtexEntry e = (BibtexEntry) c.iterator().next();

    XMPUtil.writeXMP(pdfFile, e, null);
View Full Code Here

      XMPUtil.main(new String[] { pdfFile.getAbsolutePath() });
      System.setOut(oldOut);
      s.close();
      String bibtex = s.toString();

      ParserResult result = BibtexParser.parse(new StringReader(bibtex));
      Collection<BibtexEntry> c = result.getDatabase().getEntries();
      assertEquals(1, c.size());
      BibtexEntry x = c.iterator().next();

      assertEquals(e, x);
    }
View Full Code Here

   * Test that readXMP and writeXMP work together.
   *
   * @throws Exception
   */
  public void testResolveStrings() throws Exception {
    ParserResult original = BibtexParser
        .parse(new StringReader(
            "@string{ crow = \"Crowston, K.\"}\n"
                + "@string{ anna = \"Annabi, H.\"}\n"
                + "@string{ howi = \"Howison, J.\"}\n"
                + "@string{ masa = \"Masango, C.\"}\n"
                + "@article{canh05,"
                + "  author = {#crow# and #anna# and #howi# and #masa#},"
                + "\n"
                + "  title = {Effective work practices for floss development: A model and propositions},"
                + "\n"
                + "  booktitle = {Hawaii International Conference On System Sciences (HICSS)},"
                + "\n"
                + "  year = {2005},"
                + "\n"
                + "  owner = {oezbek},"
                + "\n"
                + "  timestamp = {2006.05.29},"
                + "\n"
                + "  url = {http://james.howison.name/publications.html}"
                + "\n" + "}"));

    Collection<BibtexEntry> c = original.getDatabase().getEntries();
    assertEquals(1, c.size());

    BibtexEntry e = c.iterator().next();

    XMPUtil.writeXMP(pdfFile, e, original.getDatabase());

    List<BibtexEntry> l = XMPUtil.readXMP(pdfFile.getAbsoluteFile());
    assertEquals(1, l.size());
    BibtexEntry x = l.get(0);

View Full Code Here

   */
  @SuppressWarnings("unchecked")
  public void testResolveStrings2() throws FileNotFoundException,
      IOException, TransformerException {

    ParserResult result = BibtexParser.parse(new FileReader(
        "src/tests/net/sf/jabref/util/twente.bib"));

    assertEquals("Arvind", result.getDatabase().resolveForStrings(
        "#Arvind#"));

    AuthorList originalAuthors = AuthorList
        .getAuthorList("Patterson, David and Arvind and Asanov\\'\\i{}c, Krste and Chiou, Derek and Hoe, James and Kozyrakis, Christos and Lu, S{hih-Lien} and Oskin, Mark and Rabaey, Jan and Wawrzynek, John");

    try {
      XMPUtil.writeXMP(pdfFile, result.getDatabase().getEntryByKey(
          "Patterson06"), result.getDatabase());

      // Test whether we the main function can load the bibtex correctly
      BibtexEntry b = XMPUtil.readXMP(pdfFile).get(0);

      assertEquals(originalAuthors, AuthorList.getAuthorList(b.getField(
View Full Code Here

    assertEquals(new Integer(3), vm.getStack().pop());
    assertEquals("Hallo", vm.getStack().pop());
  }

  public static BibtexEntry bibtexString2BibtexEntry(String s) throws IOException {
    ParserResult result = BibtexParser.parse(new StringReader(s));
    Collection<BibtexEntry> c = result.getDatabase().getEntries();
    assertEquals(1, c.size());
    return c.iterator().next();
  }
View Full Code Here

        "  issn = {1526-5455}," + "\n" +
        "  publisher = {INFORMS}" + "\n" +
        "}");

    BibtexParser parser = new BibtexParser(reader);
    ParserResult result = null;
    try {
      result = parser.parse();
    } catch (Exception e){
      fail();
    }
    database = result.getDatabase();
    entry = database.getEntriesByKey("HipKro03")[0];
   
    assertNotNull(database);
    assertNotNull(entry);
  }
View Full Code Here

   * @throws FileNotFoundException
   * @throws IOException
   */
  public void testResolveStrings() throws FileNotFoundException, IOException{
   
    ParserResult result = BibtexParser.parse(new FileReader("src/tests/net/sf/jabref/util/twente.bib"));
   
    BibtexDatabase db = result.getDatabase();
   
    assertEquals("Arvind", db.resolveForStrings("#Arvind#"));
    assertEquals("Patterson, David", db.resolveForStrings("#Patterson#"));
    assertEquals("Arvind and Patterson, David", db.resolveForStrings("#Arvind# and #Patterson#"));
   
View Full Code Here

          + "  address = {Institute for Operations Research and the Management Sciences (INFORMS), Linthicum, Maryland, USA},\n"
          + "  doi = {http://dx.doi.org/10.1287/orsc.14.2.209.14992}," + "\n"
          + "  issn = {1526-5455}," + "\n" + "  publisher = {INFORMS}\n" + "}");

      BibtexParser parser = new BibtexParser(reader);
      ParserResult result = null;
      try {
        result = parser.parse();
      } catch (Exception e) {
        fail();
      }
      database = result.getDatabase();
      entry = database.getEntriesByKey("HipKro03")[0];
    }
    return entry;
  }
View Full Code Here

        try {
            //long startTime = System.currentTimeMillis();

            // Parse the temporary file.
            File tempFile = Globals.fileUpdateMonitor.getTempFile(panel.fileMonitorHandle());
            ParserResult pr = OpenDatabaseAction.loadDatabase(tempFile,
            Globals.prefs.get("defaultEncoding"));
            inTemp = pr.getDatabase();
            mdInTemp = new MetaData(pr.getMetaData(),inTemp);
            // Parse the modified file.
            pr = OpenDatabaseAction.loadDatabase(f, Globals.prefs.get("defaultEncoding"));
            BibtexDatabase onDisk = pr.getDatabase();
            MetaData mdOnDisk = new MetaData(pr.getMetaData(),onDisk);

            // Sort both databases according to a common sort key.
            EntryComparator comp = new EntryComparator(false, true, sortBy[2]);
            comp = new EntryComparator(false, true, sortBy[1], comp);
            comp = new EntryComparator(false, true, sortBy[0], comp);
View Full Code Here

TOP

Related Classes of net.sf.jabref.imports.ParserResult

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.