Package DE_EPAGES::Object::API::XML::ObjectExportDriver
This module implements a SAX2 driver to export object type(s) Object, Attribute, Class.
Base |
DE_EPAGES::XML::API::BaseExportDriver |
Example |
use DE_EPAGES::Object::API::XML::ObjectExportDriver qw( ExportObjects ); ExportObjects( '/Shops', '/tmp/shops.xml', { encoding => 'utf-8' }, ['DemoShop', 'MyShop'] ); |
@EXPORT_OK |
Functions
- ExportObjects
- addNextLevelItem
- addObject
- addObjectReference
- drive
- existsNextLevelItems
- exportDefaults
- exportLevel
- nextLevelItem
- nextLevelItems
- removeNextLevelItem
- resetNextLevelItems
- tagName
- xmlParentObject
ExportObjects
Exports object (based on DE_EPAGES::Object::API::BaseObject) into a file with given encoding
Syntax |
ExportObjects( $Path, $FileName, $hParams, $aObjects, $Transform ); |
Example |
ExportObjects( '/Shops/DemoShop', 'Products.xml', {}, [ 'Products' ] ); |
Input |
|
addNextLevelItem
Adds an object to be processed next time again, because it has references to object, which are not processed yet.
Syntax |
$self->addNextLevelItem($Object, $Level); |
Input |
|
addObject
adds an XML element (based on a BaseObject) to the SAX2 stream. calls $self->$TagName to retrieve the attributes of the element. executes registered hook functions to create sub elements. The function addHook is used to register such hook functions.
Syntax |
$self->addObject( $TagName, $Object ); |
Example |
$self->addObject( 'Company', $Company ); |
Input |
|
addObjectReference
adds an XML element (based on a BaseObject) to the SAX2 stream.
Syntax |
$self->addObjectReference( $TagName, $Object, $hAttributes ); |
Example |
$self->addObjectReference( 'Company', $Company ); |
Input |
|
drive
Runs through the objects and writes the xml content.
Syntax |
$self->drive; |
existsNextLevelItems
Returns if objects existing which should be processed next time.
Syntax |
$self->existsNextLevelItems($Level); |
Input |
|
exportDefaults
The exporter can decide, if attribute values which are equal to the default values of an class, will be exported or not.
Syntax |
$ExportDefault = $self->exportDefaults; |
Return |
|
exportLevel
In case of objects, which references multible other object (like cross selling) it nessecary that the export runs multiple times. To add objects for the next export run use addNextLevelItem.
Syntax |
$ExportLevel = $self->exportLevel; |
Return |
|
nextLevelItem
Adds an object to be processed next time again, because it has references to object, which are not processed yet.
Syntax |
$Object = $self->nextLevelItem($Level); |
Input |
|
Return |
|
nextLevelItems
Returns all objects which should be processed.
Syntax |
$self->nextLevelItems; |
removeNextLevelItem
Adds an object to be processed next time again, because it has references to object, which are not processed yet.
Syntax |
$self->removeNextLevelItem($Object, $Level); |
Input |
|
resetNextLevelItems
Resets the object which should be processed next time.
Syntax |
$self->resetNextLevelItems; |
tagName
The importer uses the TagName to find the Class of the object. Its is sometimes not possible to use the tag for the class (eg. for Products) because the class name is not unique.
Syntax |
$TagName = $self->tagName; |
Return |
|
xmlParentObject
if an xml element is processed, this function return the object of the outer xml element. This is used to resolve relative objects paths in the current xml element.
Syntax |
$Object = $self->xmlParentObject; |
Return |
|