Package gnue :: Package common :: Package definitions :: Module GParser
[show private | hide private]

Module gnue.common.definitions.GParser

Class that contains a SAX2-based XML processor for GNUe
Classes
GImport  
GImportItem This class is used for loading importable items from external resources.
xmlHandler This class is used by the XML parser to process the XML file.

Exceptions
MarkupError  
InvalidValueSetError  

Function Summary
  loadXMLObject(stream, handler, rootType, xmlFileType, initialize, attributes, initParameters, url, checkRequired)
This method loads an object from a XML stream and returns that object.
  normalise_whitespace(text)
Remove redundant whitespace characters from a string.
  buildImportableTags(rootTag, elements)
Scans XML elements and looks for 'Importable' items.

Function Details

loadXMLObject(stream, handler, rootType, xmlFileType, initialize=True, attributes={}, initParameters={}, url=None, checkRequired=True)

This method loads an object from a XML stream and returns that object. If initialize is True (default), then the object is initialized and ready to go. Setting initialize to 0 is useful for a design environment where the object is not actually being used, but simply loaded as a document.

"attributes" is a dictionary containing extra attributes that should be attached to this object.

e.g., if attributes={myproperty:[0,1,2]}, then before the object is initialized or returned, object.myproperty == [0,1,2].

normalise_whitespace(text)

Remove redundant whitespace characters from a string.
Parameters:
text - string to remove redundant whitespaces (space, tabs, ...)
Returns:
normalized string

buildImportableTags(rootTag, elements)

Scans XML elements and looks for 'Importable' items. If an object needs to be importable, simply add its tag name to the tuple below and make sure it has a "name" attribute (otherwise we don't know how to reference it in the imported file).


GNUe Home

Private API

Developer's Corner