eulxml.xmlmap.cerp - Collaborative Electronic Records Project

General Information

The Collaborative Celectronic Records Project, or CERP is a digital preservation project from the Smithsonian Institution Archives and the Rockefeller Archive Center. One particular product of that project was an XML format for email accounts. This module maps those XML objects to Python objects.

The schema produced by the project will validate only Account objects, though this module also allows the creation of subelements.

Account and Associated Objects

class eulxml.xmlmap.cerp.Account(node=None, context=None, **kwargs)

A single email account associated with a single email address and composed of multiple Folder objects and additional metadata.

http://www.records.ncdcr.gov/emailpreservation/mail-account/mail-account_docs.html#element_Account

ROOT_NAME = u'Account'
ROOT_NAMESPACES = {u'xm': u'http://www.archives.ncdcr.gov/mail-account'}
ROOT_NS = u'http://www.archives.ncdcr.gov/mail-account'
XSD_SCHEMA = u'http://www.archives.ncdcr.gov/mail-account.xsd'
email_address = <eulxml.xmlmap.fields.StringField>
folders = <eulxml.xmlmap.fields.NodeListField>
global_id = <eulxml.xmlmap.fields.StringField>
is_empty()

Returns True if the root node contains no child elements, no attributes, and no text. Returns False if any are present.

is_valid()

Determine if the current document is valid as far as we can determine. If there is a schema associated, check for schema validity. Otherwise, return True.

Return type:boolean
node = None
references_accounts = <eulxml.xmlmap.fields.NodeListField>
schema_valid()

Determine if the current document is schema-valid according to the configured XSD Schema associated with this instance of XmlObject.

Return type:boolean
Raises:Exception if no XSD schema is defined for this XmlObject instance
schema_validate = True
schema_validation_errors()

Retrieve any validation errors that occured during schema validation done via is_valid().

Returns:a list of lxml.etree._LogEntry instances
Raises:Exception if no XSD schema is defined for this XmlObject instance
serialize(stream=None, pretty=False)

Serialize the contents of the XmlObject to a stream. Serializes current node only; for the entire XML document, use serializeDocument().

If no stream is specified, returns a string. :param stream: stream or other file-like object to write content to (optional) :param pretty: pretty-print the XML output; boolean, defaults to False :rtype: stream passed in or an instance of cStringIO.StringIO

serializeDocument(stream=None, pretty=False)

Serialize the contents of the entire XML document (including Doctype declaration, if there is one), with an XML declaration, for the current XmlObject to a stream.

If no stream is specified, returns a string. :param stream: stream or other file-like object to write content to (optional) :param pretty: pretty-print the XML output; boolean, defaults to False :rtype: stream passed in or an instance of cStringIO.StringIO

validation_errors()

Return a list of validation errors. Returns an empty list if the xml is schema valid or no schema is defined. If a schema is defined but schema_validate is False, schema validation will be skipped.

Currently only supports schema validation.

Return type:list
xmlschema

A parsed XSD schema instance of lxml.etree.XMLSchema; will be loaded the first time it is requested on any instance of this class if XSD_SCHEMA is set and xmlchema is None. If you wish to load and parse the schema at class definition time, instead of at class instance initialization time, you may want to define your schema in your subclass like this:

XSD_SCHEMA = "http://www.openarchives.org/OAI/2.0/oai_dc.xsd"
xmlschema = xmlmap.loadSchema(XSD_SCHEMA)
xsl_transform(filename=None, xsl=None, return_type=None, **params)

Run an xslt transform on the contents of the XmlObject.

XSLT can be passed in as an XSLT object generated by load_xslt() or as filename or string. If a params dictionary is specified, its items will be passed as parameters to the XSL transformation, and any string values will automatically be encoded as XSL string parameters.

Note

If XSL is being used multiple times, it is recommended to use :meth`:load_xslt` to load and compile the XSLT once.

Parameters:
  • filename – xslt filename (optional, one of file and xsl is required)
  • xsl – xslt as string OR compiled XSLT object as returned by load_xslt() (optional)
  • return_type – type of object to return; optional, defaults to XmlObject; specify unicode or string for text output
Returns:

an instance of XmlObject or the return_type specified

class eulxml.xmlmap.cerp.ReferencesAccount(node=None, context=None, **kwargs)

http://www.records.ncdcr.gov/emailpreservation/mail-account/mail-account_docs.html#type_ref-account-type

REF_TYPE_CHOICES = [u'PreviousContent', u'SubsequentContent', u'Supplemental', u'SeeAlso', u'SeeInstead']
ROOT_NAME = u'ReferencesAccount'
ROOT_NAMESPACES = {u'xm': u'http://www.archives.ncdcr.gov/mail-account'}
ROOT_NS = u'http://www.archives.ncdcr.gov/mail-account'
XSD_SCHEMA = None
email_address = <eulxml.xmlmap.fields.StringField>
href = <eulxml.xmlmap.fields.StringField>
is_empty()

Returns True if the root node contains no child elements, no attributes, and no text. Returns False if any are present.

is_valid()

Determine if the current document is valid as far as we can determine. If there is a schema associated, check for schema validity. Otherwise, return True.

Return type:boolean
node = None
reference_type = <eulxml.xmlmap.fields.StringField>
schema_valid()

Determine if the current document is schema-valid according to the configured XSD Schema associated with this instance of XmlObject.

Return type:boolean
Raises:Exception if no XSD schema is defined for this XmlObject instance
schema_validate = True
schema_validation_errors()

Retrieve any validation errors that occured during schema validation done via is_valid().

Returns:a list of lxml.etree._LogEntry instances
Raises:Exception if no XSD schema is defined for this XmlObject instance
serialize(stream=None, pretty=False)

Serialize the contents of the XmlObject to a stream. Serializes current node only; for the entire XML document, use serializeDocument().

If no stream is specified, returns a string. :param stream: stream or other file-like object to write content to (optional) :param pretty: pretty-print the XML output; boolean, defaults to False :rtype: stream passed in or an instance of cStringIO.StringIO

serializeDocument(stream=None, pretty=False)

Serialize the contents of the entire XML document (including Doctype declaration, if there is one), with an XML declaration, for the current XmlObject to a stream.

If no stream is specified, returns a string. :param stream: stream or other file-like object to write content to (optional) :param pretty: pretty-print the XML output; boolean, defaults to False :rtype: stream passed in or an instance of cStringIO.StringIO

validation_errors()

Return a list of validation errors. Returns an empty list if the xml is schema valid or no schema is defined. If a schema is defined but schema_validate is False, schema validation will be skipped.

Currently only supports schema validation.

Return type:list
xmlschema

A parsed XSD schema instance of lxml.etree.XMLSchema; will be loaded the first time it is requested on any instance of this class if XSD_SCHEMA is set and xmlchema is None. If you wish to load and parse the schema at class definition time, instead of at class instance initialization time, you may want to define your schema in your subclass like this:

XSD_SCHEMA = "http://www.openarchives.org/OAI/2.0/oai_dc.xsd"
xmlschema = xmlmap.loadSchema(XSD_SCHEMA)
xsl_transform(filename=None, xsl=None, return_type=None, **params)

Run an xslt transform on the contents of the XmlObject.

XSLT can be passed in as an XSLT object generated by load_xslt() or as filename or string. If a params dictionary is specified, its items will be passed as parameters to the XSL transformation, and any string values will automatically be encoded as XSL string parameters.

Note

If XSL is being used multiple times, it is recommended to use :meth`:load_xslt` to load and compile the XSLT once.

Parameters:
  • filename – xslt filename (optional, one of file and xsl is required)
  • xsl – xslt as string OR compiled XSLT object as returned by load_xslt() (optional)
  • return_type – type of object to return; optional, defaults to XmlObject; specify unicode or string for text output
Returns:

an instance of XmlObject or the return_type specified

Folder and Associated Objects

class eulxml.xmlmap.cerp.Folder(node=None, context=None, **kwargs)

A single email folder in an Account, composed of multiple Message objects and associated metadata.

http://www.records.ncdcr.gov/emailpreservation/mail-account/mail-account_docs.html#type_folder-type

ROOT_NAME = u'Folder'
ROOT_NAMESPACES = {u'xm': u'http://www.archives.ncdcr.gov/mail-account'}
ROOT_NS = u'http://www.archives.ncdcr.gov/mail-account'
XSD_SCHEMA = None
is_empty()

Returns True if the root node contains no child elements, no attributes, and no text. Returns False if any are present.

is_valid()

Determine if the current document is valid as far as we can determine. If there is a schema associated, check for schema validity. Otherwise, return True.

Return type:boolean
mboxes = <eulxml.xmlmap.fields.NodeListField>
messages = <eulxml.xmlmap.fields.NodeListField>
name = <eulxml.xmlmap.fields.StringField>
node = None
schema_valid()

Determine if the current document is schema-valid according to the configured XSD Schema associated with this instance of XmlObject.

Return type:boolean
Raises:Exception if no XSD schema is defined for this XmlObject instance
schema_validate = True
schema_validation_errors()

Retrieve any validation errors that occured during schema validation done via is_valid().

Returns:a list of lxml.etree._LogEntry instances
Raises:Exception if no XSD schema is defined for this XmlObject instance
serialize(stream=None, pretty=False)

Serialize the contents of the XmlObject to a stream. Serializes current node only; for the entire XML document, use serializeDocument().

If no stream is specified, returns a string. :param stream: stream or other file-like object to write content to (optional) :param pretty: pretty-print the XML output; boolean, defaults to False :rtype: stream passed in or an instance of cStringIO.StringIO

serializeDocument(stream=None, pretty=False)

Serialize the contents of the entire XML document (including Doctype declaration, if there is one), with an XML declaration, for the current XmlObject to a stream.

If no stream is specified, returns a string. :param stream: stream or other file-like object to write content to (optional) :param pretty: pretty-print the XML output; boolean, defaults to False :rtype: stream passed in or an instance of cStringIO.StringIO

subfolders = <eulxml.xmlmap.fields.NodeListField>
validation_errors()

Return a list of validation errors. Returns an empty list if the xml is schema valid or no schema is defined. If a schema is defined but schema_validate is False, schema validation will be skipped.

Currently only supports schema validation.

Return type:list
xmlschema

A parsed XSD schema instance of lxml.etree.XMLSchema; will be loaded the first time it is requested on any instance of this class if XSD_SCHEMA is set and xmlchema is None. If you wish to load and parse the schema at class definition time, instead of at class instance initialization time, you may want to define your schema in your subclass like this:

XSD_SCHEMA = "http://www.openarchives.org/OAI/2.0/oai_dc.xsd"
xmlschema = xmlmap.loadSchema(XSD_SCHEMA)
xsl_transform(filename=None, xsl=None, return_type=None, **params)

Run an xslt transform on the contents of the XmlObject.

XSLT can be passed in as an XSLT object generated by load_xslt() or as filename or string. If a params dictionary is specified, its items will be passed as parameters to the XSL transformation, and any string values will automatically be encoded as XSL string parameters.

Note

If XSL is being used multiple times, it is recommended to use :meth`:load_xslt` to load and compile the XSLT once.

Parameters:
  • filename – xslt filename (optional, one of file and xsl is required)
  • xsl – xslt as string OR compiled XSLT object as returned by load_xslt() (optional)
  • return_type – type of object to return; optional, defaults to XmlObject; specify unicode or string for text output
Returns:

an instance of XmlObject or the return_type specified

class eulxml.xmlmap.cerp.Mbox(node=None, context=None, **kwargs)

http://www.records.ncdcr.gov/emailpreservation/mail-account/mail-account_docs.html#type_mbox-type

EOL_CHOICES = [u'CR', u'LF', u'CRLF']
ROOT_NAME = u'Mbox'
ROOT_NAMESPACES = {u'xm': u'http://www.archives.ncdcr.gov/mail-account'}
ROOT_NS = u'http://www.archives.ncdcr.gov/mail-account'
XSD_SCHEMA = None
create_hash(xmlobject)
eol = <eulxml.xmlmap.fields.StringField>
hash = <eulxml.xmlmap.fields.NodeField>
is_empty()

Returns True if the root node contains no child elements, no attributes, and no text. Returns False if any are present.

is_valid()

Determine if the current document is valid as far as we can determine. If there is a schema associated, check for schema validity. Otherwise, return True.

Return type:boolean
node = None
rel_path = <eulxml.xmlmap.fields.StringField>
schema_valid()

Determine if the current document is schema-valid according to the configured XSD Schema associated with this instance of XmlObject.

Return type:boolean
Raises:Exception if no XSD schema is defined for this XmlObject instance
schema_validate = True
schema_validation_errors()

Retrieve any validation errors that occured during schema validation done via is_valid().

Returns:a list of lxml.etree._LogEntry instances
Raises:Exception if no XSD schema is defined for this XmlObject instance
serialize(stream=None, pretty=False)

Serialize the contents of the XmlObject to a stream. Serializes current node only; for the entire XML document, use serializeDocument().

If no stream is specified, returns a string. :param stream: stream or other file-like object to write content to (optional) :param pretty: pretty-print the XML output; boolean, defaults to False :rtype: stream passed in or an instance of cStringIO.StringIO

serializeDocument(stream=None, pretty=False)

Serialize the contents of the entire XML document (including Doctype declaration, if there is one), with an XML declaration, for the current XmlObject to a stream.

If no stream is specified, returns a string. :param stream: stream or other file-like object to write content to (optional) :param pretty: pretty-print the XML output; boolean, defaults to False :rtype: stream passed in or an instance of cStringIO.StringIO

validation_errors()

Return a list of validation errors. Returns an empty list if the xml is schema valid or no schema is defined. If a schema is defined but schema_validate is False, schema validation will be skipped.

Currently only supports schema validation.

Return type:list
xmlschema

A parsed XSD schema instance of lxml.etree.XMLSchema; will be loaded the first time it is requested on any instance of this class if XSD_SCHEMA is set and xmlchema is None. If you wish to load and parse the schema at class definition time, instead of at class instance initialization time, you may want to define your schema in your subclass like this:

XSD_SCHEMA = "http://www.openarchives.org/OAI/2.0/oai_dc.xsd"
xmlschema = xmlmap.loadSchema(XSD_SCHEMA)
xsl_transform(filename=None, xsl=None, return_type=None, **params)

Run an xslt transform on the contents of the XmlObject.

XSLT can be passed in as an XSLT object generated by load_xslt() or as filename or string. If a params dictionary is specified, its items will be passed as parameters to the XSL transformation, and any string values will automatically be encoded as XSL string parameters.

Note

If XSL is being used multiple times, it is recommended to use :meth`:load_xslt` to load and compile the XSLT once.

Parameters:
  • filename – xslt filename (optional, one of file and xsl is required)
  • xsl – xslt as string OR compiled XSLT object as returned by load_xslt() (optional)
  • return_type – type of object to return; optional, defaults to XmlObject; specify unicode or string for text output
Returns:

an instance of XmlObject or the return_type specified

Message and Associated Objects

class eulxml.xmlmap.cerp.Message(node=None, context=None, **kwargs)

A single email message in a Folder.

http://www.records.ncdcr.gov/emailpreservation/mail-account/mail-account_docs.html#type_message-type

EOL_CHOICES = [u'CR', u'LF', u'CRLF']
ROOT_NAME = u'Message'
ROOT_NAMESPACES = {u'xm': u'http://www.archives.ncdcr.gov/mail-account'}
ROOT_NS = u'http://www.archives.ncdcr.gov/mail-account'
STATUS_FLAG_CHOICES = [u'Seen', u'Answered', u'Flagged', u'Deleted', u'Draft', u'Recent']
XSD_SCHEMA = None
bcc_list = <eulxml.xmlmap.fields.StringListField>
body
cc_list = <eulxml.xmlmap.fields.StringListField>
comments_list = <eulxml.xmlmap.fields.StringListField>
create_hash(xmlobject)
create_incomplete_list(xmlobject)
create_multi_body(xmlobject)
create_single_body(xmlobject)
eol = <eulxml.xmlmap.fields.StringField>
classmethod from_email_message(message, local_id=None)

Convert an email.message.Message or compatible message object into a CERP XML eulxml.xmlmap.cerp.Message. If an id is specified, it will be stored in the Message <LocalId>.

Parameters:
  • messageemail.message.Message object
  • id – optional message id to be set as local_id
Returns:

eulxml.xmlmap.cerp.Message instance populated with message information

from_list = <eulxml.xmlmap.fields.StringListField>
hash = <eulxml.xmlmap.fields.NodeField>
headers = <eulxml.xmlmap.fields.NodeListField>
in_reply_to_list = <eulxml.xmlmap.fields.StringListField>
incomplete_list = <eulxml.xmlmap.fields.NodeField>
is_empty()

Returns True if the root node contains no child elements, no attributes, and no text. Returns False if any are present.

is_valid()

Determine if the current document is valid as far as we can determine. If there is a schema associated, check for schema validity. Otherwise, return True.

Return type:boolean
keywords_list = <eulxml.xmlmap.fields.StringListField>
local_id = <eulxml.xmlmap.fields.IntegerField>
message_id = <eulxml.xmlmap.fields.StringField>
message_id_supplied = <eulxml.xmlmap.fields.SimpleBooleanField>
mime_version = <eulxml.xmlmap.fields.StringField>
multi_body = <eulxml.xmlmap.fields.NodeField>
node = None
orig_date_list = <eulxml.xmlmap.fields.StringListField>
references_list = <eulxml.xmlmap.fields.StringListField>
rel_path = <eulxml.xmlmap.fields.StringField>
schema_valid()

Determine if the current document is schema-valid according to the configured XSD Schema associated with this instance of XmlObject.

Return type:boolean
Raises:Exception if no XSD schema is defined for this XmlObject instance
schema_validate = True
schema_validation_errors()

Retrieve any validation errors that occured during schema validation done via is_valid().

Returns:a list of lxml.etree._LogEntry instances
Raises:Exception if no XSD schema is defined for this XmlObject instance
sender_list = <eulxml.xmlmap.fields.StringListField>
serialize(stream=None, pretty=False)

Serialize the contents of the XmlObject to a stream. Serializes current node only; for the entire XML document, use serializeDocument().

If no stream is specified, returns a string. :param stream: stream or other file-like object to write content to (optional) :param pretty: pretty-print the XML output; boolean, defaults to False :rtype: stream passed in or an instance of cStringIO.StringIO

serializeDocument(stream=None, pretty=False)

Serialize the contents of the entire XML document (including Doctype declaration, if there is one), with an XML declaration, for the current XmlObject to a stream.

If no stream is specified, returns a string. :param stream: stream or other file-like object to write content to (optional) :param pretty: pretty-print the XML output; boolean, defaults to False :rtype: stream passed in or an instance of cStringIO.StringIO

single_body = <eulxml.xmlmap.fields.NodeField>
status_flags = <eulxml.xmlmap.fields.StringListField>
subject_list = <eulxml.xmlmap.fields.StringListField>
to_list = <eulxml.xmlmap.fields.StringListField>
validation_errors()

Return a list of validation errors. Returns an empty list if the xml is schema valid or no schema is defined. If a schema is defined but schema_validate is False, schema validation will be skipped.

Currently only supports schema validation.

Return type:list
xmlschema

A parsed XSD schema instance of lxml.etree.XMLSchema; will be loaded the first time it is requested on any instance of this class if XSD_SCHEMA is set and xmlchema is None. If you wish to load and parse the schema at class definition time, instead of at class instance initialization time, you may want to define your schema in your subclass like this:

XSD_SCHEMA = "http://www.openarchives.org/OAI/2.0/oai_dc.xsd"
xmlschema = xmlmap.loadSchema(XSD_SCHEMA)
xsl_transform(filename=None, xsl=None, return_type=None, **params)

Run an xslt transform on the contents of the XmlObject.

XSLT can be passed in as an XSLT object generated by load_xslt() or as filename or string. If a params dictionary is specified, its items will be passed as parameters to the XSL transformation, and any string values will automatically be encoded as XSL string parameters.

Note

If XSL is being used multiple times, it is recommended to use :meth`:load_xslt` to load and compile the XSLT once.

Parameters:
  • filename – xslt filename (optional, one of file and xsl is required)
  • xsl – xslt as string OR compiled XSLT object as returned by load_xslt() (optional)
  • return_type – type of object to return; optional, defaults to XmlObject; specify unicode or string for text output
Returns:

an instance of XmlObject or the return_type specified

class eulxml.xmlmap.cerp.ChildMessage(node=None, context=None, **kwargs)

http://www.records.ncdcr.gov/emailpreservation/mail-account/mail-account_docs.html#type_child-message-type

ROOT_NAME = u'ChildMessage'
ROOT_NAMESPACES = {u'xm': u'http://www.archives.ncdcr.gov/mail-account'}
ROOT_NS = u'http://www.archives.ncdcr.gov/mail-account'
XSD_SCHEMA = None
bcc_list = <eulxml.xmlmap.fields.StringListField>
body
cc_list = <eulxml.xmlmap.fields.StringListField>
comments_list = <eulxml.xmlmap.fields.StringListField>
create_incomplete_list(xmlobject)
create_multi_body(xmlobject)
create_single_body(xmlobject)
from_list = <eulxml.xmlmap.fields.StringListField>
headers = <eulxml.xmlmap.fields.NodeListField>
in_reply_to_list = <eulxml.xmlmap.fields.StringListField>
incomplete_list = <eulxml.xmlmap.fields.NodeField>
is_empty()

Returns True if the root node contains no child elements, no attributes, and no text. Returns False if any are present.

is_valid()

Determine if the current document is valid as far as we can determine. If there is a schema associated, check for schema validity. Otherwise, return True.

Return type:boolean
keywords_list = <eulxml.xmlmap.fields.StringListField>
local_id = <eulxml.xmlmap.fields.IntegerField>
message_id = <eulxml.xmlmap.fields.StringField>
message_id_supplied = <eulxml.xmlmap.fields.SimpleBooleanField>
mime_version = <eulxml.xmlmap.fields.StringField>
multi_body = <eulxml.xmlmap.fields.NodeField>
node = None
orig_date_list = <eulxml.xmlmap.fields.StringListField>
references_list = <eulxml.xmlmap.fields.StringListField>
schema_valid()

Determine if the current document is schema-valid according to the configured XSD Schema associated with this instance of XmlObject.

Return type:boolean
Raises:Exception if no XSD schema is defined for this XmlObject instance
schema_validate = True
schema_validation_errors()

Retrieve any validation errors that occured during schema validation done via is_valid().

Returns:a list of lxml.etree._LogEntry instances
Raises:Exception if no XSD schema is defined for this XmlObject instance
sender_list = <eulxml.xmlmap.fields.StringListField>
serialize(stream=None, pretty=False)

Serialize the contents of the XmlObject to a stream. Serializes current node only; for the entire XML document, use serializeDocument().

If no stream is specified, returns a string. :param stream: stream or other file-like object to write content to (optional) :param pretty: pretty-print the XML output; boolean, defaults to False :rtype: stream passed in or an instance of cStringIO.StringIO

serializeDocument(stream=None, pretty=False)

Serialize the contents of the entire XML document (including Doctype declaration, if there is one), with an XML declaration, for the current XmlObject to a stream.

If no stream is specified, returns a string. :param stream: stream or other file-like object to write content to (optional) :param pretty: pretty-print the XML output; boolean, defaults to False :rtype: stream passed in or an instance of cStringIO.StringIO

single_body = <eulxml.xmlmap.fields.NodeField>
subject_list = <eulxml.xmlmap.fields.StringListField>
to_list = <eulxml.xmlmap.fields.StringListField>
validation_errors()

Return a list of validation errors. Returns an empty list if the xml is schema valid or no schema is defined. If a schema is defined but schema_validate is False, schema validation will be skipped.

Currently only supports schema validation.

Return type:list
xmlschema

A parsed XSD schema instance of lxml.etree.XMLSchema; will be loaded the first time it is requested on any instance of this class if XSD_SCHEMA is set and xmlchema is None. If you wish to load and parse the schema at class definition time, instead of at class instance initialization time, you may want to define your schema in your subclass like this:

XSD_SCHEMA = "http://www.openarchives.org/OAI/2.0/oai_dc.xsd"
xmlschema = xmlmap.loadSchema(XSD_SCHEMA)
xsl_transform(filename=None, xsl=None, return_type=None, **params)

Run an xslt transform on the contents of the XmlObject.

XSLT can be passed in as an XSLT object generated by load_xslt() or as filename or string. If a params dictionary is specified, its items will be passed as parameters to the XSL transformation, and any string values will automatically be encoded as XSL string parameters.

Note

If XSL is being used multiple times, it is recommended to use :meth`:load_xslt` to load and compile the XSLT once.

Parameters:
  • filename – xslt filename (optional, one of file and xsl is required)
  • xsl – xslt as string OR compiled XSLT object as returned by load_xslt() (optional)
  • return_type – type of object to return; optional, defaults to XmlObject; specify unicode or string for text output
Returns:

an instance of XmlObject or the return_type specified

class eulxml.xmlmap.cerp.SingleBody(node=None, context=None, **kwargs)

http://www.records.ncdcr.gov/emailpreservation/mail-account/mail-account_docs.html#type_single-body-type

ROOT_NAME = u'SingleBody'
ROOT_NAMESPACES = {u'xm': u'http://www.archives.ncdcr.gov/mail-account'}
ROOT_NS = u'http://www.archives.ncdcr.gov/mail-account'
XSD_SCHEMA = None
body_content = <eulxml.xmlmap.fields.NodeField>
charset_list = <eulxml.xmlmap.fields.StringListField>
child_message = <eulxml.xmlmap.fields.NodeField>
content
content_id_comments_list = <eulxml.xmlmap.fields.StringListField>
content_id_list = <eulxml.xmlmap.fields.StringListField>
content_name_list = <eulxml.xmlmap.fields.StringListField>
content_type_comments_list = <eulxml.xmlmap.fields.StringListField>
content_type_list = <eulxml.xmlmap.fields.StringListField>
content_type_param_list = <eulxml.xmlmap.fields.NodeListField>
create_body_content(xmlobject)
create_child_message(xmlobject)
create_ext_body_content(xmlobject)
description_comments_list = <eulxml.xmlmap.fields.StringListField>
description_list = <eulxml.xmlmap.fields.StringListField>
disposition_comments_list = <eulxml.xmlmap.fields.StringListField>
disposition_file_name_list = <eulxml.xmlmap.fields.StringListField>
disposition_list = <eulxml.xmlmap.fields.StringListField>
disposition_params = <eulxml.xmlmap.fields.NodeListField>
ext_body_content = <eulxml.xmlmap.fields.NodeField>
is_empty()

Returns True if the root node contains no child elements, no attributes, and no text. Returns False if any are present.

is_valid()

Determine if the current document is valid as far as we can determine. If there is a schema associated, check for schema validity. Otherwise, return True.

Return type:boolean
node = None
other_mime_headers = <eulxml.xmlmap.fields.NodeListField>
phantom_body = <eulxml.xmlmap.fields.StringField>
schema_valid()

Determine if the current document is schema-valid according to the configured XSD Schema associated with this instance of XmlObject.

Return type:boolean
Raises:Exception if no XSD schema is defined for this XmlObject instance
schema_validate = True
schema_validation_errors()

Retrieve any validation errors that occured during schema validation done via is_valid().

Returns:a list of lxml.etree._LogEntry instances
Raises:Exception if no XSD schema is defined for this XmlObject instance
serialize(stream=None, pretty=False)

Serialize the contents of the XmlObject to a stream. Serializes current node only; for the entire XML document, use serializeDocument().

If no stream is specified, returns a string. :param stream: stream or other file-like object to write content to (optional) :param pretty: pretty-print the XML output; boolean, defaults to False :rtype: stream passed in or an instance of cStringIO.StringIO

serializeDocument(stream=None, pretty=False)

Serialize the contents of the entire XML document (including Doctype declaration, if there is one), with an XML declaration, for the current XmlObject to a stream.

If no stream is specified, returns a string. :param stream: stream or other file-like object to write content to (optional) :param pretty: pretty-print the XML output; boolean, defaults to False :rtype: stream passed in or an instance of cStringIO.StringIO

transfer_encoding_comments_list = <eulxml.xmlmap.fields.StringListField>
transfer_encoding_list = <eulxml.xmlmap.fields.StringListField>
validation_errors()

Return a list of validation errors. Returns an empty list if the xml is schema valid or no schema is defined. If a schema is defined but schema_validate is False, schema validation will be skipped.

Currently only supports schema validation.

Return type:list
xmlschema

A parsed XSD schema instance of lxml.etree.XMLSchema; will be loaded the first time it is requested on any instance of this class if XSD_SCHEMA is set and xmlchema is None. If you wish to load and parse the schema at class definition time, instead of at class instance initialization time, you may want to define your schema in your subclass like this:

XSD_SCHEMA = "http://www.openarchives.org/OAI/2.0/oai_dc.xsd"
xmlschema = xmlmap.loadSchema(XSD_SCHEMA)
xsl_transform(filename=None, xsl=None, return_type=None, **params)

Run an xslt transform on the contents of the XmlObject.

XSLT can be passed in as an XSLT object generated by load_xslt() or as filename or string. If a params dictionary is specified, its items will be passed as parameters to the XSL transformation, and any string values will automatically be encoded as XSL string parameters.

Note

If XSL is being used multiple times, it is recommended to use :meth`:load_xslt` to load and compile the XSLT once.

Parameters:
  • filename – xslt filename (optional, one of file and xsl is required)
  • xsl – xslt as string OR compiled XSLT object as returned by load_xslt() (optional)
  • return_type – type of object to return; optional, defaults to XmlObject; specify unicode or string for text output
Returns:

an instance of XmlObject or the return_type specified

class eulxml.xmlmap.cerp.MultiBody(node=None, context=None, **kwargs)

http://www.records.ncdcr.gov/emailpreservation/mail-account/mail-account_docs.html#type_multi-body-type

ROOT_NAME = u'MultiBody'
ROOT_NAMESPACES = {u'xm': u'http://www.archives.ncdcr.gov/mail-account'}
ROOT_NS = u'http://www.archives.ncdcr.gov/mail-account'
XSD_SCHEMA = None
body
create_multi_body(xmlobject)
create_single_body(xmlobject)
epilogue = <eulxml.xmlmap.fields.StringField>
is_empty()

Returns True if the root node contains no child elements, no attributes, and no text. Returns False if any are present.

is_valid()

Determine if the current document is valid as far as we can determine. If there is a schema associated, check for schema validity. Otherwise, return True.

Return type:boolean
multi_body = <eulxml.xmlmap.fields.NodeField>
node = None
preamble = <eulxml.xmlmap.fields.StringField>
schema_valid()

Determine if the current document is schema-valid according to the configured XSD Schema associated with this instance of XmlObject.

Return type:boolean
Raises:Exception if no XSD schema is defined for this XmlObject instance
schema_validate = True
schema_validation_errors()

Retrieve any validation errors that occured during schema validation done via is_valid().

Returns:a list of lxml.etree._LogEntry instances
Raises:Exception if no XSD schema is defined for this XmlObject instance
serialize(stream=None, pretty=False)

Serialize the contents of the XmlObject to a stream. Serializes current node only; for the entire XML document, use serializeDocument().

If no stream is specified, returns a string. :param stream: stream or other file-like object to write content to (optional) :param pretty: pretty-print the XML output; boolean, defaults to False :rtype: stream passed in or an instance of cStringIO.StringIO

serializeDocument(stream=None, pretty=False)

Serialize the contents of the entire XML document (including Doctype declaration, if there is one), with an XML declaration, for the current XmlObject to a stream.

If no stream is specified, returns a string. :param stream: stream or other file-like object to write content to (optional) :param pretty: pretty-print the XML output; boolean, defaults to False :rtype: stream passed in or an instance of cStringIO.StringIO

single_body = <eulxml.xmlmap.fields.NodeField>
validation_errors()

Return a list of validation errors. Returns an empty list if the xml is schema valid or no schema is defined. If a schema is defined but schema_validate is False, schema validation will be skipped.

Currently only supports schema validation.

Return type:list
xmlschema

A parsed XSD schema instance of lxml.etree.XMLSchema; will be loaded the first time it is requested on any instance of this class if XSD_SCHEMA is set and xmlchema is None. If you wish to load and parse the schema at class definition time, instead of at class instance initialization time, you may want to define your schema in your subclass like this:

XSD_SCHEMA = "http://www.openarchives.org/OAI/2.0/oai_dc.xsd"
xmlschema = xmlmap.loadSchema(XSD_SCHEMA)
xsl_transform(filename=None, xsl=None, return_type=None, **params)

Run an xslt transform on the contents of the XmlObject.

XSLT can be passed in as an XSLT object generated by load_xslt() or as filename or string. If a params dictionary is specified, its items will be passed as parameters to the XSL transformation, and any string values will automatically be encoded as XSL string parameters.

Note

If XSL is being used multiple times, it is recommended to use :meth`:load_xslt` to load and compile the XSLT once.

Parameters:
  • filename – xslt filename (optional, one of file and xsl is required)
  • xsl – xslt as string OR compiled XSLT object as returned by load_xslt() (optional)
  • return_type – type of object to return; optional, defaults to XmlObject; specify unicode or string for text output
Returns:

an instance of XmlObject or the return_type specified

class eulxml.xmlmap.cerp.Incomplete(node=None, context=None, **kwargs)

http://www.records.ncdcr.gov/emailpreservation/mail-account/mail-account_docs.html#type_incomplete-parse-type

ROOT_NAME = u'Incomplete'
ROOT_NAMESPACES = {u'xm': u'http://www.archives.ncdcr.gov/mail-account'}
ROOT_NS = u'http://www.archives.ncdcr.gov/mail-account'
XSD_SCHEMA = None
error_location = <eulxml.xmlmap.fields.StringField>
error_type = <eulxml.xmlmap.fields.StringField>
is_empty()

Returns True if the root node contains no child elements, no attributes, and no text. Returns False if any are present.

is_valid()

Determine if the current document is valid as far as we can determine. If there is a schema associated, check for schema validity. Otherwise, return True.

Return type:boolean
node = None
schema_valid()

Determine if the current document is schema-valid according to the configured XSD Schema associated with this instance of XmlObject.

Return type:boolean
Raises:Exception if no XSD schema is defined for this XmlObject instance
schema_validate = True
schema_validation_errors()

Retrieve any validation errors that occured during schema validation done via is_valid().

Returns:a list of lxml.etree._LogEntry instances
Raises:Exception if no XSD schema is defined for this XmlObject instance
serialize(stream=None, pretty=False)

Serialize the contents of the XmlObject to a stream. Serializes current node only; for the entire XML document, use serializeDocument().

If no stream is specified, returns a string. :param stream: stream or other file-like object to write content to (optional) :param pretty: pretty-print the XML output; boolean, defaults to False :rtype: stream passed in or an instance of cStringIO.StringIO

serializeDocument(stream=None, pretty=False)

Serialize the contents of the entire XML document (including Doctype declaration, if there is one), with an XML declaration, for the current XmlObject to a stream.

If no stream is specified, returns a string. :param stream: stream or other file-like object to write content to (optional) :param pretty: pretty-print the XML output; boolean, defaults to False :rtype: stream passed in or an instance of cStringIO.StringIO

validation_errors()

Return a list of validation errors. Returns an empty list if the xml is schema valid or no schema is defined. If a schema is defined but schema_validate is False, schema validation will be skipped.

Currently only supports schema validation.

Return type:list
xmlschema

A parsed XSD schema instance of lxml.etree.XMLSchema; will be loaded the first time it is requested on any instance of this class if XSD_SCHEMA is set and xmlchema is None. If you wish to load and parse the schema at class definition time, instead of at class instance initialization time, you may want to define your schema in your subclass like this:

XSD_SCHEMA = "http://www.openarchives.org/OAI/2.0/oai_dc.xsd"
xmlschema = xmlmap.loadSchema(XSD_SCHEMA)
xsl_transform(filename=None, xsl=None, return_type=None, **params)

Run an xslt transform on the contents of the XmlObject.

XSLT can be passed in as an XSLT object generated by load_xslt() or as filename or string. If a params dictionary is specified, its items will be passed as parameters to the XSL transformation, and any string values will automatically be encoded as XSL string parameters.

Note

If XSL is being used multiple times, it is recommended to use :meth`:load_xslt` to load and compile the XSLT once.

Parameters:
  • filename – xslt filename (optional, one of file and xsl is required)
  • xsl – xslt as string OR compiled XSLT object as returned by load_xslt() (optional)
  • return_type – type of object to return; optional, defaults to XmlObject; specify unicode or string for text output
Returns:

an instance of XmlObject or the return_type specified

class eulxml.xmlmap.cerp.BodyContent(node=None, context=None, **kwargs)

http://www.records.ncdcr.gov/emailpreservation/mail-account/mail-account_docs.html#type_int-body-content-type

ROOT_NAME = u'BodyContent'
ROOT_NAMESPACES = {u'xm': u'http://www.archives.ncdcr.gov/mail-account'}
ROOT_NS = u'http://www.archives.ncdcr.gov/mail-account'
XSD_SCHEMA = None
charset_list = <eulxml.xmlmap.fields.StringListField>
content = <eulxml.xmlmap.fields.StringField>
is_empty()

Returns True if the root node contains no child elements, no attributes, and no text. Returns False if any are present.

is_valid()

Determine if the current document is valid as far as we can determine. If there is a schema associated, check for schema validity. Otherwise, return True.

Return type:boolean
node = None
schema_valid()

Determine if the current document is schema-valid according to the configured XSD Schema associated with this instance of XmlObject.

Return type:boolean
Raises:Exception if no XSD schema is defined for this XmlObject instance
schema_validate = True
schema_validation_errors()

Retrieve any validation errors that occured during schema validation done via is_valid().

Returns:a list of lxml.etree._LogEntry instances
Raises:Exception if no XSD schema is defined for this XmlObject instance
serialize(stream=None, pretty=False)

Serialize the contents of the XmlObject to a stream. Serializes current node only; for the entire XML document, use serializeDocument().

If no stream is specified, returns a string. :param stream: stream or other file-like object to write content to (optional) :param pretty: pretty-print the XML output; boolean, defaults to False :rtype: stream passed in or an instance of cStringIO.StringIO

serializeDocument(stream=None, pretty=False)

Serialize the contents of the entire XML document (including Doctype declaration, if there is one), with an XML declaration, for the current XmlObject to a stream.

If no stream is specified, returns a string. :param stream: stream or other file-like object to write content to (optional) :param pretty: pretty-print the XML output; boolean, defaults to False :rtype: stream passed in or an instance of cStringIO.StringIO

transfer_encoding_list = <eulxml.xmlmap.fields.StringListField>
validation_errors()

Return a list of validation errors. Returns an empty list if the xml is schema valid or no schema is defined. If a schema is defined but schema_validate is False, schema validation will be skipped.

Currently only supports schema validation.

Return type:list
xmlschema

A parsed XSD schema instance of lxml.etree.XMLSchema; will be loaded the first time it is requested on any instance of this class if XSD_SCHEMA is set and xmlchema is None. If you wish to load and parse the schema at class definition time, instead of at class instance initialization time, you may want to define your schema in your subclass like this:

XSD_SCHEMA = "http://www.openarchives.org/OAI/2.0/oai_dc.xsd"
xmlschema = xmlmap.loadSchema(XSD_SCHEMA)
xsl_transform(filename=None, xsl=None, return_type=None, **params)

Run an xslt transform on the contents of the XmlObject.

XSLT can be passed in as an XSLT object generated by load_xslt() or as filename or string. If a params dictionary is specified, its items will be passed as parameters to the XSL transformation, and any string values will automatically be encoded as XSL string parameters.

Note

If XSL is being used multiple times, it is recommended to use :meth`:load_xslt` to load and compile the XSLT once.

Parameters:
  • filename – xslt filename (optional, one of file and xsl is required)
  • xsl – xslt as string OR compiled XSLT object as returned by load_xslt() (optional)
  • return_type – type of object to return; optional, defaults to XmlObject; specify unicode or string for text output
Returns:

an instance of XmlObject or the return_type specified

class eulxml.xmlmap.cerp.ExtBodyContent(node=None, context=None, **kwargs)

http://www.records.ncdcr.gov/emailpreservation/mail-account/mail-account_docs.html#type_ext-body-content-type

EOL_CHOICES = [u'CR', u'LF', u'CRLF']
ROOT_NAME = u'ExtBodyContent'
ROOT_NAMESPACES = {u'xm': u'http://www.archives.ncdcr.gov/mail-account'}
ROOT_NS = u'http://www.archives.ncdcr.gov/mail-account'
XSD_SCHEMA = None
charset_list = <eulxml.xmlmap.fields.StringListField>
create_hash(xmlobject)
eol = <eulxml.xmlmap.fields.StringField>
hash = <eulxml.xmlmap.fields.NodeField>
is_empty()

Returns True if the root node contains no child elements, no attributes, and no text. Returns False if any are present.

is_valid()

Determine if the current document is valid as far as we can determine. If there is a schema associated, check for schema validity. Otherwise, return True.

Return type:boolean
local_id = <eulxml.xmlmap.fields.IntegerField>
node = None
rel_path = <eulxml.xmlmap.fields.StringField>
schema_valid()

Determine if the current document is schema-valid according to the configured XSD Schema associated with this instance of XmlObject.

Return type:boolean
Raises:Exception if no XSD schema is defined for this XmlObject instance
schema_validate = True
schema_validation_errors()

Retrieve any validation errors that occured during schema validation done via is_valid().

Returns:a list of lxml.etree._LogEntry instances
Raises:Exception if no XSD schema is defined for this XmlObject instance
serialize(stream=None, pretty=False)

Serialize the contents of the XmlObject to a stream. Serializes current node only; for the entire XML document, use serializeDocument().

If no stream is specified, returns a string. :param stream: stream or other file-like object to write content to (optional) :param pretty: pretty-print the XML output; boolean, defaults to False :rtype: stream passed in or an instance of cStringIO.StringIO

serializeDocument(stream=None, pretty=False)

Serialize the contents of the entire XML document (including Doctype declaration, if there is one), with an XML declaration, for the current XmlObject to a stream.

If no stream is specified, returns a string. :param stream: stream or other file-like object to write content to (optional) :param pretty: pretty-print the XML output; boolean, defaults to False :rtype: stream passed in or an instance of cStringIO.StringIO

transfer_encoding_list = <eulxml.xmlmap.fields.StringListField>
validation_errors()

Return a list of validation errors. Returns an empty list if the xml is schema valid or no schema is defined. If a schema is defined but schema_validate is False, schema validation will be skipped.

Currently only supports schema validation.

Return type:list
xml_wrapped = <eulxml.xmlmap.fields.SimpleBooleanField>
xmlschema

A parsed XSD schema instance of lxml.etree.XMLSchema; will be loaded the first time it is requested on any instance of this class if XSD_SCHEMA is set and xmlchema is None. If you wish to load and parse the schema at class definition time, instead of at class instance initialization time, you may want to define your schema in your subclass like this:

XSD_SCHEMA = "http://www.openarchives.org/OAI/2.0/oai_dc.xsd"
xmlschema = xmlmap.loadSchema(XSD_SCHEMA)
xsl_transform(filename=None, xsl=None, return_type=None, **params)

Run an xslt transform on the contents of the XmlObject.

XSLT can be passed in as an XSLT object generated by load_xslt() or as filename or string. If a params dictionary is specified, its items will be passed as parameters to the XSL transformation, and any string values will automatically be encoded as XSL string parameters.

Note

If XSL is being used multiple times, it is recommended to use :meth`:load_xslt` to load and compile the XSLT once.

Parameters:
  • filename – xslt filename (optional, one of file and xsl is required)
  • xsl – xslt as string OR compiled XSLT object as returned by load_xslt() (optional)
  • return_type – type of object to return; optional, defaults to XmlObject; specify unicode or string for text output
Returns:

an instance of XmlObject or the return_type specified

Additional Utility Objects

class eulxml.xmlmap.cerp.Parameter(node=None, context=None, **kwargs)

http://www.records.ncdcr.gov/emailpreservation/mail-account/mail-account_docs.html#type_parameter-type

ROOT_NAME = u'Parameter'
ROOT_NAMESPACES = {u'xm': u'http://www.archives.ncdcr.gov/mail-account'}
ROOT_NS = u'http://www.archives.ncdcr.gov/mail-account'
XSD_SCHEMA = None
is_empty()

Returns True if the root node contains no child elements, no attributes, and no text. Returns False if any are present.

is_valid()

Determine if the current document is valid as far as we can determine. If there is a schema associated, check for schema validity. Otherwise, return True.

Return type:boolean
name = <eulxml.xmlmap.fields.StringField>
node = None
schema_valid()

Determine if the current document is schema-valid according to the configured XSD Schema associated with this instance of XmlObject.

Return type:boolean
Raises:Exception if no XSD schema is defined for this XmlObject instance
schema_validate = True
schema_validation_errors()

Retrieve any validation errors that occured during schema validation done via is_valid().

Returns:a list of lxml.etree._LogEntry instances
Raises:Exception if no XSD schema is defined for this XmlObject instance
serialize(stream=None, pretty=False)

Serialize the contents of the XmlObject to a stream. Serializes current node only; for the entire XML document, use serializeDocument().

If no stream is specified, returns a string. :param stream: stream or other file-like object to write content to (optional) :param pretty: pretty-print the XML output; boolean, defaults to False :rtype: stream passed in or an instance of cStringIO.StringIO

serializeDocument(stream=None, pretty=False)

Serialize the contents of the entire XML document (including Doctype declaration, if there is one), with an XML declaration, for the current XmlObject to a stream.

If no stream is specified, returns a string. :param stream: stream or other file-like object to write content to (optional) :param pretty: pretty-print the XML output; boolean, defaults to False :rtype: stream passed in or an instance of cStringIO.StringIO

validation_errors()

Return a list of validation errors. Returns an empty list if the xml is schema valid or no schema is defined. If a schema is defined but schema_validate is False, schema validation will be skipped.

Currently only supports schema validation.

Return type:list
value = <eulxml.xmlmap.fields.StringField>
xmlschema

A parsed XSD schema instance of lxml.etree.XMLSchema; will be loaded the first time it is requested on any instance of this class if XSD_SCHEMA is set and xmlchema is None. If you wish to load and parse the schema at class definition time, instead of at class instance initialization time, you may want to define your schema in your subclass like this:

XSD_SCHEMA = "http://www.openarchives.org/OAI/2.0/oai_dc.xsd"
xmlschema = xmlmap.loadSchema(XSD_SCHEMA)
xsl_transform(filename=None, xsl=None, return_type=None, **params)

Run an xslt transform on the contents of the XmlObject.

XSLT can be passed in as an XSLT object generated by load_xslt() or as filename or string. If a params dictionary is specified, its items will be passed as parameters to the XSL transformation, and any string values will automatically be encoded as XSL string parameters.

Note

If XSL is being used multiple times, it is recommended to use :meth`:load_xslt` to load and compile the XSLT once.

Parameters:
  • filename – xslt filename (optional, one of file and xsl is required)
  • xsl – xslt as string OR compiled XSLT object as returned by load_xslt() (optional)
  • return_type – type of object to return; optional, defaults to XmlObject; specify unicode or string for text output
Returns:

an instance of XmlObject or the return_type specified

class eulxml.xmlmap.cerp.Header(node=None, context=None, **kwargs)

http://www.records.ncdcr.gov/emailpreservation/mail-account/mail-account_docs.html#type_header-type

ROOT_NAME = u'Header'
ROOT_NAMESPACES = {u'xm': u'http://www.archives.ncdcr.gov/mail-account'}
ROOT_NS = u'http://www.archives.ncdcr.gov/mail-account'
XSD_SCHEMA = None
comments = <eulxml.xmlmap.fields.StringListField>
is_empty()

Returns True if the root node contains no child elements, no attributes, and no text. Returns False if any are present.

is_valid()

Determine if the current document is valid as far as we can determine. If there is a schema associated, check for schema validity. Otherwise, return True.

Return type:boolean
name = <eulxml.xmlmap.fields.StringField>
node = None
schema_valid()

Determine if the current document is schema-valid according to the configured XSD Schema associated with this instance of XmlObject.

Return type:boolean
Raises:Exception if no XSD schema is defined for this XmlObject instance
schema_validate = True
schema_validation_errors()

Retrieve any validation errors that occured during schema validation done via is_valid().

Returns:a list of lxml.etree._LogEntry instances
Raises:Exception if no XSD schema is defined for this XmlObject instance
serialize(stream=None, pretty=False)

Serialize the contents of the XmlObject to a stream. Serializes current node only; for the entire XML document, use serializeDocument().

If no stream is specified, returns a string. :param stream: stream or other file-like object to write content to (optional) :param pretty: pretty-print the XML output; boolean, defaults to False :rtype: stream passed in or an instance of cStringIO.StringIO

serializeDocument(stream=None, pretty=False)

Serialize the contents of the entire XML document (including Doctype declaration, if there is one), with an XML declaration, for the current XmlObject to a stream.

If no stream is specified, returns a string. :param stream: stream or other file-like object to write content to (optional) :param pretty: pretty-print the XML output; boolean, defaults to False :rtype: stream passed in or an instance of cStringIO.StringIO

validation_errors()

Return a list of validation errors. Returns an empty list if the xml is schema valid or no schema is defined. If a schema is defined but schema_validate is False, schema validation will be skipped.

Currently only supports schema validation.

Return type:list
value = <eulxml.xmlmap.fields.StringField>
xmlschema

A parsed XSD schema instance of lxml.etree.XMLSchema; will be loaded the first time it is requested on any instance of this class if XSD_SCHEMA is set and xmlchema is None. If you wish to load and parse the schema at class definition time, instead of at class instance initialization time, you may want to define your schema in your subclass like this:

XSD_SCHEMA = "http://www.openarchives.org/OAI/2.0/oai_dc.xsd"
xmlschema = xmlmap.loadSchema(XSD_SCHEMA)
xsl_transform(filename=None, xsl=None, return_type=None, **params)

Run an xslt transform on the contents of the XmlObject.

XSLT can be passed in as an XSLT object generated by load_xslt() or as filename or string. If a params dictionary is specified, its items will be passed as parameters to the XSL transformation, and any string values will automatically be encoded as XSL string parameters.

Note

If XSL is being used multiple times, it is recommended to use :meth`:load_xslt` to load and compile the XSLT once.

Parameters:
  • filename – xslt filename (optional, one of file and xsl is required)
  • xsl – xslt as string OR compiled XSLT object as returned by load_xslt() (optional)
  • return_type – type of object to return; optional, defaults to XmlObject; specify unicode or string for text output
Returns:

an instance of XmlObject or the return_type specified

class eulxml.xmlmap.cerp.Hash(node=None, context=None, **kwargs)

http://www.records.ncdcr.gov/emailpreservation/mail-account/mail-account_docs.html#type_hash-type

HASH_FUNCTION_CHOICES = [u'MD5', u'WHIRLPOOL', u'SHA1', u'SHA224', u'SHA256', u'SHA384', u'SHA512', u'RIPEMD160']
ROOT_NAME = u'Hash'
ROOT_NAMESPACES = {u'xm': u'http://www.archives.ncdcr.gov/mail-account'}
ROOT_NS = u'http://www.archives.ncdcr.gov/mail-account'
XSD_SCHEMA = None
function = <eulxml.xmlmap.fields.StringField>
is_empty()

Returns True if the root node contains no child elements, no attributes, and no text. Returns False if any are present.

is_valid()

Determine if the current document is valid as far as we can determine. If there is a schema associated, check for schema validity. Otherwise, return True.

Return type:boolean
node = None
schema_valid()

Determine if the current document is schema-valid according to the configured XSD Schema associated with this instance of XmlObject.

Return type:boolean
Raises:Exception if no XSD schema is defined for this XmlObject instance
schema_validate = True
schema_validation_errors()

Retrieve any validation errors that occured during schema validation done via is_valid().

Returns:a list of lxml.etree._LogEntry instances
Raises:Exception if no XSD schema is defined for this XmlObject instance
serialize(stream=None, pretty=False)

Serialize the contents of the XmlObject to a stream. Serializes current node only; for the entire XML document, use serializeDocument().

If no stream is specified, returns a string. :param stream: stream or other file-like object to write content to (optional) :param pretty: pretty-print the XML output; boolean, defaults to False :rtype: stream passed in or an instance of cStringIO.StringIO

serializeDocument(stream=None, pretty=False)

Serialize the contents of the entire XML document (including Doctype declaration, if there is one), with an XML declaration, for the current XmlObject to a stream.

If no stream is specified, returns a string. :param stream: stream or other file-like object to write content to (optional) :param pretty: pretty-print the XML output; boolean, defaults to False :rtype: stream passed in or an instance of cStringIO.StringIO

validation_errors()

Return a list of validation errors. Returns an empty list if the xml is schema valid or no schema is defined. If a schema is defined but schema_validate is False, schema validation will be skipped.

Currently only supports schema validation.

Return type:list
value = <eulxml.xmlmap.fields.StringField>
xmlschema

A parsed XSD schema instance of lxml.etree.XMLSchema; will be loaded the first time it is requested on any instance of this class if XSD_SCHEMA is set and xmlchema is None. If you wish to load and parse the schema at class definition time, instead of at class instance initialization time, you may want to define your schema in your subclass like this:

XSD_SCHEMA = "http://www.openarchives.org/OAI/2.0/oai_dc.xsd"
xmlschema = xmlmap.loadSchema(XSD_SCHEMA)
xsl_transform(filename=None, xsl=None, return_type=None, **params)

Run an xslt transform on the contents of the XmlObject.

XSLT can be passed in as an XSLT object generated by load_xslt() or as filename or string. If a params dictionary is specified, its items will be passed as parameters to the XSL transformation, and any string values will automatically be encoded as XSL string parameters.

Note

If XSL is being used multiple times, it is recommended to use :meth`:load_xslt` to load and compile the XSLT once.

Parameters:
  • filename – xslt filename (optional, one of file and xsl is required)
  • xsl – xslt as string OR compiled XSLT object as returned by load_xslt() (optional)
  • return_type – type of object to return; optional, defaults to XmlObject; specify unicode or string for text output
Returns:

an instance of XmlObject or the return_type specified