Banner showing base of Eiffel tower

Github

Download version 1.4.8: Windows or Linux

Persistency Library: Document Node-scanning and Object Building

This library has 53 classes.

ECF: document-scan.ecf

Source code: directory list

A set of abstractions for scanning the nodes of an XML-like document without any commitment to a particular document syntax. Parsers to generate events are provided by separate libraries.

Provides:

Base library for:

XML Node Scanning

The abstraction EL_PARSE_EVENT_SOURCE representing a parse-event source has 5 useful descendants:

EL_PARSE_EVENT_SOURCE*
   EL_BINARY_ENCODED_PARSE_EVENT_SOURCE
   EL_EXPAT_XML_PARSER
      EL_EXPAT_XML_PARSER_OUTPUT_MEDIUM
      EL_EXPAT_XML_WITH_CTRL_Z_PARSER
      EL_EXPAT_XHTML_PARSER
   EL_DEFAULT_PARSE_EVENT_SOURCE
   EL_PYXIS_PARSER

Class EL_BINARY_ENCODED_PARSE_EVENT_SOURCE is a binary encoded XML event source, useful for reducing the size of large documents for transfer across a network.

The following are the various kinds of scanners which can process the output from these event sources.

Eiffel Object Building Scanners

The classes EL_BUILDABLE_FROM_XML and EL_BUILDABLE_FROM_PYXIS can be used to implement a sophisticated Eiffel object building scheme based on the idea of mapping builder agents to xpaths relative to particular element contexts. Only a small subset of the xpath standard is used. The framework has the following features:

General Xpath to Eiffel agent mapper

The class EL_CREATEABLE_FROM_XPATH_MATCH_EVENTS implements a method for scanning a document and triggering various Eiffel agents according to a table of xpath to agent mappings.

Eiffel Aware Document Scanner

The class EL_SMART_BUILDABLE_FROM_NODE_SCAN is an XML parser that reacts to a special XML processing instruction, telling it to build an Eiffel object of a particular type.

Directory: library/persistency/document

. /createable

. /eif-object-building/context

. /eif-object-building/reflective-context

. /event-handler

. /node

. /scanner

. /scanner/event-source

. /support

. /xpath

createable

EL_BUILDABLE_FROM_NODE_SCAN

Top level abstraction for building nested Eiffel objects by matching relative xpaths to an XML parse event source defined by new_node_source. The xpaths are mapped to agents by implementing the function building_action_table found in class EL_EIF_OBJ_BUILDER_CONTEXT. Typically the agents assign a class attribute value by calling a value function of the last_node object. But the agent might also change the Eiffel object context by calling the procedure set_next_context. The new context is mapped to some element in the document and all xpaths in the new current context are relative to this element. Returning to the parent context happens automatically when all the nodes in the current element have been visited. The top level context is defined by implementing the attribute root_node_name which defines the root element name.

The most useful descendants of this class are EL_BUILDABLE_FROM_XML and EL_BUILDABLE_FROM_PYXIS. The latter implements a parser for Pyxis, an XML analog with a Python inspired syntax.

Further Information

Click on class link to see descendants and client examples.

EL_CREATEABLE_FROM_NODE_SCAN

Object that is createable from document parse events

Further Information

Click on class link to see client examples.

EL_CREATEABLE_FROM_XPATH_MATCH_EVENTS

Object that scans an XML node event source, matching visited nodes against a user defined set of xpaths. Matching nodes trigger a call to an agent defined in the mapping function xpath_match_events. The agent can process the visited node by accessing the last_node attribute.

Further Information

Click on class link to see notes and client examples.

EL_DEFAULT_BUILDABLE_FROM_NODE_SCAN

Default buildable from node scan

EL_DOCUMENT_NODE_XPATH_MATCHER

Map xpath node matches of XML/Pyxis document to EL_XPATH_TO_AGENT_MAP handlers

Further Information

Click on class link to see client examples.

EL_FILE_PERSISTENT_BUILDABLE_FROM_NODE_SCAN

File persistent buildable from node scan

EL_SMART_BUILDABLE_FROM_NODE_SCAN

Node scan builder that can respond to a create processing instructions before the root element as for example:

<?xml version="1.0" encoding="UTF-8"?>
<?create {SMIL_PRESENTATION}?>
<smil>
..
</smil>

SMIL_PRESENTATION' implements the deferred class EL_BUILDABLE_FROM_NODE_SCAN. The created object is accessible via the stack container result_stack.

Further Information

Click on class link to see client examples.

EL_XPATH_SET_COMPILER

Compiles a set of all unique xpaths during document scan

eif-object-building/context

EL_EIF_OBJ_BUILDER_CONTEXT

Eiffel object model Xpath context

Further Information

Click on class link to see notes and client examples.

EL_EIF_OBJ_ROOT_BUILDER_CONTEXT

Eiffel object root builder context

EL_EIF_OBJ_TEXT_TABLE_CONTEXT

Convenience class to store all element values for a context in a table but without recursing deeper

Further Information

Click on class link to see client examples.

EL_EIF_OBJ_XPATH_CONTEXT

Eiffel object xpath context

Further Information

Click on class link to see notes and client examples.

EL_SMART_EIF_OBJ_ROOT_BUILDER_CONTEXT

Root builder context that changes the type of the target object to build according to a processing instruction at the start of the XML. The example below will build an instance of class SMIL_PRESENTATION.

<?xml version="1.0" encoding="utf-8"?>
<?create {SMIL_PRESENTATION}?>
<smil xmlns="http://www.w3.org/2001/SMIL20/Language">
..
</smil>

EL_XPATH_CONTEXT

Xpath to a document node

eif-object-building/reflective-context

EL_EIF_OBJ_BUILDER_CONTEXT_CLASS_META_DATA

Eiffel object builder context class meta data

EL_EIF_OBJ_BUILDER_CONTEXT_TYPE_CONSTANTS

Eiffel object builder context type constants

EL_REFLECTIVELY_BUILDABLE_FROM_NODE_SCAN

Reflectively buildable from node scan

EL_REFLECTIVE_EIF_OBJ_BUILDER_CONTEXT

Reflective Eiffel object builder (from XML) context

Further Information

Click on class link to see descendants and client examples.

EL_REFLECTIVE_OBJECT_BUILDER_CONTEXT

EL_EIF_OBJ_BUILDER_CONTEXT for EL_REFLECTIVE object attribute

event-handler

EL_DOCUMENT_CRC_32_HANDLER

Document cyclic redundancy check 32

Further Information

Click on class link to see client examples.

EL_DOCUMENT_PARSE_EVENT_HANDLER

Xml node event handler

EL_XHTML_WORD_COUNTER

Xhtml word counter

Further Information

Click on class link to see client examples.

node

EL_DOCUMENT_NODE_STRING

Document node string with specific encoding encoding_name

Further Information

Click on class link to see client examples.

EL_ELEMENT_ATTRIBUTE_LIST

Document element attribute list

Further Information

Click on class link to see client examples.

EL_ELEMENT_ATTRIBUTE_NODE_STRING

XML element attribute node string

Further Information

Click on class link to see client examples.

scanner

EL_BINARY_ENCODED_DOCUMENT_SCANNER

Binary encoded XML document scanner

Further Information

Click on class link to see client examples.

EL_DOCUMENT_EIFFEL_OBJECT_BUILDER

Eiffel object builder from XML/Pyxix node scanning source

EL_DOCUMENT_NODE_LOGGER

Xml document logger

Further Information

Click on class link to see client examples.

EL_DOCUMENT_NODE_SCANNER

Object that scans an abstract parseable document consisting of the following node types: Scans sequentially the XML node visiting events originating from event_source.

Further Information

Click on class link to see notes.

EL_DOCUMENT_NODE_SCAN_SOURCE

Object that applies XML parse events to the construction of an object

EL_PARSE_EVENT_GENERATOR

General parse event generator that can use Pyxis or XML as input source

Further Information

Click on class link to see client examples.

EL_SMART_NODE_SCAN_TO_EIFFEL_OBJECT_BUILDER

Smart node scan to eiffel object builder

EL_XML_TEXT_GENERATOR

Generate XML document from node scan source to output. If output conforms to EL_OUTPUT_MEDIUM then the output encoding is the one set in the medium, otherwise the output encoding is the same as event_source.encoding.

EL_XPATH_ACTION_TABLE

Agent actions to be applied on each match of a tokenized xpath EL_TOKENIZED_XPATH while scanning a document object conforming to EL_XPATH_MATCH_SCAN_SOURCE

EL_XPATH_MATCH_SCAN_SOURCE

Class for scanning document nodes and checking if each node path matches against a set of xpath expressions, each mapped to procedure. If a node matches, the procedure is called.

EL_XPATH_SET_SCAN_SOURCE

Compiles a set of all unique xpaths for document

scanner/event-source

EL_BINARY_ENCODED_PARSE_EVENT_SOURCE

Binary encoded parse event source

Further Information

Click on class link to see client examples.

EL_BINARY_ENCODED_PARSE_EVENT_TYPE

Binary encoded xml parse event type

Further Information

Click on class link to see client examples.

EL_DEFAULT_PARSE_EVENT_SOURCE

Default parse event source

EL_PARSE_EVENT_SOURCE

Parse event source for Pyxis or XML document

Further Information

Click on class link to see descendants.

support

EL_ATTRIBUTE_NODE_HINTS

Hints for reflective classes as to which fields should be explicitly mapped to XML attribute text

Further Information

Click on class link to see notes and client examples.

EL_ATTRIBUTE_TYPE_ROUTINES

Type of EL_REFLECTED_FIELD for purposes of mapping to XML attribute

EL_DOCUMENT_CLIENT

XML node client

Further Information

Click on class link to see client examples.

EL_ELEMENT_NODE_HINTS

Hints for reflective classes as to which fields should be explicitly mapped to XML element text with the default being a map to an element attribute.

Further Information

Click on class link to see notes.

EL_NODE_HINTS

Hints for reflective classes as to how fields should be mapped to XML attributes/elements

EL_PARSER_OUTPUT_MEDIUM

Document parser output medium

EL_PARSE_EVENT_CONSTANTS

Xml parse event stream

EL_SMIL_VALUE_PARSING

Smil value parsing

Further Information

Click on class link to see client examples.

xpath

EL_NODE_CONSTANTS

Constants for document node scanning

Further Information

Click on class link to see client examples.

EL_TOKENIZED_XPATH

Tokenized form of xpath

EL_XPATH_NODE_CONSTANTS

Xpath node type constants

EL_XPATH_TOKEN_TABLE

Xpath step token table

EL_XPATH_TO_AGENT_MAP

Xpath to agent map

Further Information

Click on class link to see client examples.