Cheshire3 Objects: Parser

|  | # Cheshire3 Objects: Parser

## Description

Normally a simple wrapper around an XML parser, these objects can be viewed as Record Factories. They take a Document containing some XML and produce the equivalent Record.

## Implementations

The following implementations are pre-configured and ready to use.
They may be used out-of-the-box in configurations for Workflows, or in code by getting the object from a Server.

- defaultParser
  A Parser that uses Python's standard XML Library Minidom parser - creates MinidomRecords.
- SaxParser
  A Parser to create SaxRecords.
- NsSaxParser
  A Parser to create SaxRecords, dealing with namespaces.
- defaultRecordStoreParser
  A Parser to create SaxRecords from the serialization stored in a recordStore.
- LxmlParser
  Libxml2 DOM parser - creates LxmlRecords
- LxmlHtmlParser
  Libxml2 DOM parser for HTML (i.e. tolerates imperfectly formed XML e.g. unclosed <br>) - creates LxmlRecords

API

Module: cheshire3.parser

- MinidomParser
  Python standard library's Minidom parser - creates MinidomRecords
- SaxParser
  Default SAX based parser - creates SaxRecords
- StoredSaxParser
  Creates SaxRecords from a serialization in a recordStore
- LxmlParser
  Libxml2 DOM parser - creates LxmlRecords
- LxmlHtmlParser
  Libxml2 DOM parser for HTML (i.e. tolerates imperfectly formed XML e.g. unclosed <br>) - creates LxmlRecords
- PassThroughParser
  Parser to simply copy the data from a document (e.g. list of sax events or a DOM tree) into an appropriate record object.
- MarcParser
  Parser for MARC data - creates MarcRecords

Methods:

Function | Parameters | Returns | Description
--- | --- | --- | ---
__init__ | config, parent |  |
process_document | session, document | Record | Return a record after parsing from an XML document

### Sub-Packages

Sub-package: graph
Module: cheshire3.graph.parser

- RdfGraphParser
  RDF serialization parser - creates GraphRecords.
  Parser must be configured with appropriate format setting, currently supports :
  - xml
  - trix
  - nt
  - n3
  - rdfa
- RdfaParser
  RDFa serialization parser that uses pyRdfa - creates GraphRecords.