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 48 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_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

. /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_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.

eif-object-building

EL_SETTABLE_FROM_XML_NODE

A helper class for implementing the function building_action_table from class EL_EIF_OBJ_BUILDER_CONTEXT by using Eiffel reflection to map xpath's derived from object field names to a setter agent.

The implementing class must also inherit class EL_REFLECTIVE either directly or from one of it's descendants.

Further Information

Click on class link to see descendants.

eif-object-building/context

EL_DEFAULT_EIF_OBJ_XPATH_CONTEXT

Default eif obj xpath context

EL_EIF_OBJ_BUILDER_CONTEXT

Eiffel object model Xpath context

Further Information

Click on class link to see 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 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>

eif-object-building/reflective-context

EL_EIF_OBJ_BUILDER_CONTEXT_CLASS_META_DATA

Eif obj builder context class meta data

EL_EIF_OBJ_BUILDER_CONTEXT_TYPE_CONSTANTS

Eifel object builder context type constants

EL_REFLECTED_COLLECTION_EIF_OBJ_BUILDER_CONTEXT

Reflected collection of Eiffel object builder contexts

EL_REFLECTED_EIF_OBJ_BUILDER_CONTEXT

Reflected eif obj builder context

EL_REFLECTIVELY_BUILDABLE_FROM_NODE_SCAN

Reflective buildable from node scan

Further Information

Click on class link to see notes.

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.

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

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

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.

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

support

EL_DOCUMENT_CLIENT

Xml node client

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_PARSED_XPATH_STEP

Parsed xpath step

Further Information

Click on class link to see client examples.

EL_TOKENIZED_XPATH

Tokenized form of xpath

EL_XPATH_CONSTANTS

Xpath constants

EL_XPATH_PARSER

Simple xpath parser that can parse xpaths like the following:

AAA/BBB
AAA/BBB/@name
AAA/BBB[@id='x']
AAA/BBB[@id='x']/@name
AAA/BBB[id='y']/CCC/text()

<AAA>
   <BBB id="x" name="foo">
   </BBB>
   <BBB id="y" name="bar">
      <CCC>hello</CCC>
   </BBB>
</AAA>

but cannot parse:

AAA/BBB[2]/@name

Further Information

Click on class link to see client examples.

EL_XPATH_TOKEN_TABLE

Xpath token table

EL_XPATH_TO_AGENT_MAP

Xpath to agent map

Further Information

Click on class link to see client examples.