Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

XmlAdaptiveModel Class Reference

An adaptive XML modeling class. More...

#include <xmladaptivemodel.h>

Inheritance diagram for XmlAdaptiveModel:

XmlModelBase UserOfTextCodec UserOfFunnelDevice List of all members.

Public Methods

 XmlAdaptiveModel (void)
 A constructor. More...

virtual ~XmlAdaptiveModel (void)
 A destructor. More...

virtual bool manageEvent (XmlModelEvent *event)
 Manage XML events. More...

virtual void setGrammar (GrammarBase *gr)
 Set a grammar for the model. More...

virtual void setSAXEmitter (SAXEmitter *emitter, void *data=0)
 Set SAX emitter for decoding. More...

virtual void receiveData (XmlChar *data, size_t size)
 Receive data from another object. More...


Protected Attributes

GrammarBasegrammar
 The pointer to the grammar used for compression.

bool inCDATA
 Indication of CDATA section.

bool inCharacters
 Indication of the characters section.

bool inComment
 Indication of the comment section.

char inPI
 Indication of the processing instruction section. More...

bool inProlog
 indication whether we are in the XML prolog.

bool inNACK
 Indication whether the model has to perform some NACK operation.

bool inDoctype
 Indication of DOCTYPE section.

bool inAttr
 Indication whether the model is processing the attributes of some element.

bool inAttrValue
 Indication if the value of some attribute is being read.

bool firstAttrRead
 Indication whether the first attribute of the element has been read.

bool nackEndedInCharacters
 Indication when NACK caused a step to a character node.

int attrPos
 The position when reading the attributes. More...

AdaptiveStructuralSymbols::Symbol state
 State of the model. More...

ElementIdselementIds
 Hashtable of element ids.

AdaptiveElementTableelements
 Hashtable of element contexts.

AttributeNamesTableattributeNames
 Hashtable of attribute names.

ElementNamesListelementNamesList
 List of element names.

unsigned long elementCounter
 Counter for unique element numbering.

AttributeIdsattributeIds
 Hashtable of attribute ids.

AttributeNamesListattributeNamesList
 List of attribute names.

unsigned long attributeCounter
 Counter for unique attribute numbering.

Stack< unsigned long > * elementStack
 Stack of element ids. More...

Stack< ElementModelerInfoelementModelerStack
 A stack of modelers of the elements.

List< ElementModelerelementModelerList
 The list of modelers of the elements.

size_t clueEdge
 The value of the clue edge.

bool readingNackData
 Indication whether the model is reading the NACK data.

XmlChar * buffer
 Buffer for read data. More...

size_t bufferLength
 Length of the data in the buffer.

size_t fibBits
 Number of read bits of Fibonacci code. More...

unsigned long fibCode
 Read Fibonacci code. More...

bool fibLastWasOne
 Helper variable for decoding the Fibonacci codes.

DataQueuedataQueue
 A queue of decoded data items (such as attribute names and values, etc.).

SAXEmittersaxEmitter
 Pointer to the SAX emitter. More...

void * userData
 User data for SAX emitter. More...


Detailed Description

An adaptive XML modeling class.

This class implements an adaptive model used for encoding and decoding of XML data. When compressing, the model tries to build an oriented graph describing the elements of the document, and to predict the document's structure on the basis of this graphs.

Definition at line 166 of file xmladaptivemodel.h.


Constructor & Destructor Documentation

XmlAdaptiveModel::XmlAdaptiveModel void   
 

A constructor.

Initialization is performed.

Definition at line 236 of file xmladaptivemodel.cpp.

References attributeCounter, attributeIds, attributeNames, attributeNamesList, attrPos, buffer, bufferLength, clueEdge, dataQueue, elementCounter, elementIds, elementModelerList, elementModelerStack, elementNamesList, elements, elementStack, fibBits, fibCode, fibLastWasOne, firstAttrRead, grammar, inAttr, inAttrValue, inCDATA, inCharacters, inDoctype, inNACK, inProlog, nackEndedInCharacters, NEW, readingNackData, saxEmitter, Collection< ElementModelerInfo >::setAutoDelete, Collection< ElementModeler >::setAutoDelete, HashTable< unsigned long, XmlChar, List, 3079 >::setAutoDelete, Collection< XmlChar >::setAutoDelete, HashTable< unsigned long, AdaptiveElementContext, List, 3079 >::setAutoDelete, HashTable< XmlChar *, unsigned long, List, 3079 >::setAutoDelete, Collection< unsigned >::setAutoDelete, Collection< DataQueueItem >::setAutoDelete, state, and userData.

XmlAdaptiveModel::~XmlAdaptiveModel void    [virtual]
 

A destructor.

The resources occupied by the model are freed. In verbose mode, the information about the entropy of the document is displayed.

Definition at line 318 of file xmladaptivemodel.cpp.

References attributeIds, attributeNames, attributeNamesList, ElementModeler::computeAverageEntropy, Collection< XmlChar >::count, dataQueue, DELETE, elementModelerList, elementNamesList, elements, elementStack, List< ElementModeler >::first, ElementModeler::getAverageEntropy, ExaltOptions::getOption, ElementModeler::getRefCount, List< ElementModeler >::next, OUTPUTEENDLINE, OUTPUTENL, ElementModeler::print, ExaltOptions::PrintModels, ExaltOptions::Verbose, and ExaltOptions::Yes.


Member Function Documentation

bool XmlAdaptiveModel::manageEvent XmlModelEvent   event [virtual]
 

Manage XML events.

This methods implements the encoding procedure. The model accepts the XML events here and writes the (transformed) data to the underlying grammar.

Parameters:
event  The XML event.

Implements XmlModelBase.

Definition at line 397 of file xmladaptivemodel.cpp.

References List< ElementModeler >::append, List< XmlChar >::append, GrammarBase::append, APPEND_ALL_DATA, APPEND_ALL_DATA_LENGTH, APPEND_ALL_DATA_LENGTH_CONVERT_AMP, APPEND_BUFFER_DATA, XmlStartElementEvent::attr, attributeCounter, attributeIds, attributeNames, attributeNamesList, ElementModelerInfo::building, XmlModelEvent::Characters, CHECK_POINTER, clueEdge, XmlModelEvent::Comment, UserOfTextCodec::createDefaultTextCodec, XmlPIEvent::data, XmlCommentEvent::data, XmlDefaultEvent::data, XmlCharactersEvent::data, DBG, XmlModelEvent::Default, DELETE, XmlStartDoctypeEvent::doctypeName, elementCounter, elementIds, elementModelerList, elementModelerStack, elementNamesList, elements, elementStack, Fibonacci::encodeToBuffer, XmlDeclEvent::encoding, END_CHARACTER_DATA_SECTION, XmlModelEvent::EndCDATA, XmlModelEvent::EndDoctype, XmlModelEvent::EndElement, XmlModelEvent::EntityDecl, XmlEntityDeclEvent::entityName, FATAL, HashTable< unsigned long, AdaptiveElementContext, List, 3079 >::find, HashTable< XmlChar *, unsigned long, List, 3079 >::find, TextCodec::getMIB, grammar, XmlStartDoctypeEvent::hasInternalSubset, inCharacters, INCREASE_CLUE_EDGE, ElementModeler::increaseRefCount, HashTable< unsigned long, XmlChar, List, 3079 >::insert, HashTable< unsigned long, AdaptiveElementContext, List, 3079 >::insert, HashTable< XmlChar *, unsigned long, List, 3079 >::insert, Collection< ElementModelerInfo >::isEmpty, XmlEntityDeclEvent::isParameterEntity, XmlDefaultEvent::length, XmlCharactersEvent::length, ElementModelerInfo::modeler, AdaptiveElementContext::modeler, ElementModeler::moveToDesiredNode, XmlEndElementEvent::name, AdaptiveElementContext::name, XmlStartElementEvent::name, NEW, XmlModelEvent::NotationDecl, XmlNotationDeclEvent::notationName, XmlEntityDeclEvent::notationName, XmlModelEvent::PI, Stack< ElementModelerInfo >::pop, Stack< unsigned long >::pop, ElementModeler::popCurrentNode, XmlNotationDeclEvent::publicId, XmlEntityDeclEvent::publicId, XmlStartDoctypeEvent::publicId, Stack< unsigned long >::push, Stack< ElementModelerInfo >::push, REPORT_DIFFERENT_EDGE, REPORT_NACK, RESET_CLUE_EDGE, ElementModeler::resetCurrentNode, GrammarBase::setAlphabetBaseSize, ElementModeler::setAttributes, XmlDeclEvent::standalone, XmlModelEvent::StartCDATA, XmlModelEvent::StartDoctype, XmlModelEvent::StartElement, TextCodec::suggestAlphabetBaseSize, XmlNotationDeclEvent::systemId, XmlEntityDeclEvent::systemId, XmlStartDoctypeEvent::systemId, XmlPIEvent::target, UserOfTextCodec::textCodec, Stack< ElementModelerInfo >::top, XmlModelEvent::type, XmlEntityDeclEvent::value, XmlEntityDeclEvent::valueLength, XmlDeclEvent::version, WRN, XmlChar, xmlchar_strcpy, xmlchar_strlen, and XmlModelEvent::XmlDecl.

void XmlAdaptiveModel::receiveData XmlChar *    data,
size_t    size
[virtual]
 

Receive data from another object.

This method implements the decoding procedure. It receives data from the underlying grammar and reconstructs the XML data.

Parameters:
data  The data coming from the grammar.
size  The length of the data.

Implements XmlModelBase.

Definition at line 1396 of file xmladaptivemodel.cpp.

References List< ElementModeler >::append, List< XmlChar >::append, attributeCounter, attributeNames, attributeNamesList, attrPos, buffer, bufferLength, ElementModelerInfo::building, CHANGE_STATE, CHECK_POINTER, Queue< DataQueueItem >::clear, clueEdge, Collection< DataQueueItem >::count, Collection< ElementModelerInfo >::count, ElementModeler::currentNodeType, DataQueueItem::data, dataQueue, DBG, Fibonacci::decode, DELETE, Queue< DataQueueItem >::dequeue, elementCounter, elementModelerList, elementModelerStack, elementNamesList, elements, elementStack, Queue< DataQueueItem >::enqueue, FATAL, fibBits, fibCode, fibLastWasOne, HashTable< unsigned long, XmlChar, List, 3079 >::find, HashTable< unsigned long, AdaptiveElementContext, List, 3079 >::find, FINISH_START_ELEMENT_WITH_NO_ATTRIBUTES, firstAttrRead, ElementModeler::followEdge, ElementModeler::getCurrentNode, ElementModeler::getElementName, ElementModeler::hasAttributes, inAttr, inAttrValue, inCDATA, inCharacters, inComment, ElementModeler::increaseRefCount, inDoctype, inNACK, inPI, inProlog, HashTable< unsigned long, AdaptiveElementContext, List, 3079 >::insert, HashTable< unsigned long, XmlChar, List, 3079 >::insert, Collection< DataQueueItem >::isEmpty, Collection< ElementModelerInfo >::isEmpty, AdaptiveElementContext::modeler, ElementModel::Node::modeler, ElementModelerInfo::modeler, ElementModeler::moveForward, ElementModeler::moveToDesiredNode, nackEndedInCharacters, AdaptiveElementContext::name, NEW, Stack< unsigned long >::pop, Stack< ElementModelerInfo >::pop, ElementModeler::popCurrentNode, Stack< unsigned long >::push, Stack< ElementModelerInfo >::push, readingNackData, RESET_BUFFER, RESET_STATE, ElementModeler::resetCurrentNode, SAFE_CALL_EMITTER, saxEmitter, ElementModeler::setAttributes, state, Stack< ElementModelerInfo >::top, ElementModel::Node::type, DataQueueItem::type, userData, XML_MODEL_BUFFER_DEFAULT_SIZE, XmlChar, xmlchar_strcpy, and xmlchar_strlen.

virtual void XmlAdaptiveModel::setGrammar GrammarBase   gr [inline, virtual]
 

Set a grammar for the model.

Sets a grammar that is used for the compression of the data.

Parameters:
gr  The pointer to the grammar.

Implements XmlModelBase.

Definition at line 185 of file xmladaptivemodel.h.

References grammar.

void XmlAdaptiveModel::setSAXEmitter SAXEmitter   emitter,
void *    data = 0
[virtual]
 

Set SAX emitter for decoding.

Sets the SAX emitter and (optionaly) the user data.

Parameters:
emitter  The SAX emitter.
data  The user data structure.

Implements XmlModelBase.

Definition at line 385 of file xmladaptivemodel.cpp.

References saxEmitter, and userData.


Member Data Documentation

int XmlAdaptiveModel::attrPos [protected]
 

The position when reading the attributes.

Value 0 indicates that we are starting to read the attributes, and value 1 means that we read all the attributes.

Definition at line 242 of file xmladaptivemodel.h.

Referenced by receiveData, and XmlAdaptiveModel.

XmlChar* XmlAdaptiveModel::buffer [protected]
 

Buffer for read data.

Used during decoding.

Definition at line 305 of file xmladaptivemodel.h.

Referenced by receiveData, and XmlAdaptiveModel.

Stack<unsigned long>* XmlAdaptiveModel::elementStack [protected]
 

Stack of element ids.

Stores the "level" in the document.

Definition at line 284 of file xmladaptivemodel.h.

Referenced by manageEvent, receiveData, XmlAdaptiveModel, and ~XmlAdaptiveModel.

size_t XmlAdaptiveModel::fibBits [protected]
 

Number of read bits of Fibonacci code.

Used during decoding.

Definition at line 317 of file xmladaptivemodel.h.

Referenced by receiveData, and XmlAdaptiveModel.

unsigned long XmlAdaptiveModel::fibCode [protected]
 

Read Fibonacci code.

Used during decoding.

Definition at line 324 of file xmladaptivemodel.h.

Referenced by receiveData, and XmlAdaptiveModel.

char XmlAdaptiveModel::inPI [protected]
 

Indication of the processing instruction section.

The value 2 indicates that a target is being read, and value 1 indicates that a value is being read.

Definition at line 214 of file xmladaptivemodel.h.

Referenced by receiveData.

SAXEmitter* XmlAdaptiveModel::saxEmitter [protected]
 

Pointer to the SAX emitter.

Used during decoding.

Definition at line 337 of file xmladaptivemodel.h.

Referenced by receiveData, setSAXEmitter, and XmlAdaptiveModel.

AdaptiveStructuralSymbols::Symbol XmlAdaptiveModel::state [protected]
 

State of the model.

Used during decoding. State is represented by AdaptiveStructuralSymbols.

Definition at line 249 of file xmladaptivemodel.h.

Referenced by receiveData, and XmlAdaptiveModel.

void* XmlAdaptiveModel::userData [protected]
 

User data for SAX emitter.

Used during decoding.

Definition at line 344 of file xmladaptivemodel.h.

Referenced by receiveData, setSAXEmitter, and XmlAdaptiveModel.


The documentation for this class was generated from the following files:
Generated on Wed Feb 5 10:43:06 2003 for Exalt by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002