Skip to content

Parsing Bibliography Files

Lance A. Endres edited this page Mar 4, 2025 · 1 revision

Introduction

This page demonstrates the basics of parsing a bibliography file. This was the functionality of the original library, however, this has largely been superseded by bibliography file reading.

Usage at a glance

  • string -> BibEntry
var parser = new BibParser(
                new StringReader(
                  "@article{keyword, title = {\"0\"{123}456{789}}, year = 2012, address=\"PingLeYuan\"}"));
var entry = parser.GetAllResult()[0];
  • BibEntry
// Get Property
entry.Type;       // string: Article
entry.Title;      // string: 0{123}456{789}
entry["Title"];   // string: 0{123}456{789}
  • BibEntry -> string
entry.ToString();
// @Article{keyword,
//   title = {0{123}456{789}},
//   year = {2012},
//   address = {PingLeYuan},
// }
  • Local File -> BibEntries
var parser = new BibParser(new StreamReader("text.bib", Encoding.Default));
var entries = parser.GetAllResult();

foreach(var entry in entries) { ... }

Clone this wiki locally