ePages 6.10 - DE_EPAGES/XML/API/BaseImportHandler.pm

Package DE_EPAGES::XML::API::BaseImportHandler

This is the base class for XML import handlers.

Functions

collectCharacters
existsReturn
getAttributes
getCharacters
importXML
new
popID
popReturn
pushID
pushReturn
stackID
stackReturn
topElement
topID
topReturn
varsOnErrorString

collectCharacters

If called with one parameter, this function enables or disables character parsing. Previously parsed characters are reset. If called without parameters, the funtion returns true if character parsing is enabled. See also getCharacters

Syntax
$self->collectCharacters( $Enable );
my $Enable = $self->collectCharacters;
Example
if( $self->collectCharacters ) {
    print $self->getCharacters;
    $self->collectCharacters( 0 );
}
Input
$Enable (boolean)
0/1 : disable/enable character parsing
Return
$Enable (boolean)
true if character parsing is enabled

existsReturn

Returns true if at least value exists on the stack.

Syntax
$CompanyID = $self->existsReturn( 'CompanyID' )
Input
$Key (string)
return value name
Return
$Value (string)
return value

getAttributes

Returns the attributes of an element as hash.

Syntax
$hAttributes = $self->getAttributes( $Element );
$hAttributes = $self->getAttributes( ( $Element, $Namespace );
Example
my $Name = $self->getAttributes( $Element )->{'Name'};
Input
$Element (string)
element object (first parameter of start_element)
$Namespace (string)
XML namespace name (default='')
Return
$hAttributes (hash ref)
attributes hash

getCharacters

Syntax
$String = $self->getCharacters;
Example
Returns the parsed text between XML tags that has been collected since
character parsing has been enabled with
$self-><function collectCharacters>( 1 ).
if( $self->collectCharacters ) {
    print $self->getCharacters;
    $self->collectCharacters( 0 );
}
Return
$String (string)
parsed character string

importXML

Imports classes and attributes from an XML file.

Syntax
$Package->importXML( $FileName );
$Handler = $Package->new;
$Handler->importXML( $FileName );
Input
$FileName (string)
XML file name

new

Creates a new XML import handler object.

Syntax
$Handler = DE_EPAGES::XML::API::BaseImportHandler->new();
Return
$Handler (object)
SAX handler

popID

Returns the most recently added parameter and removes leaves it from the stack.

Syntax
$CompanyID = $self->popID( 'CompanyID' )
Input
$Key (string)
parameter name
Return
$Value (string)
parameter value

popReturn

Returns the most recently added value and removes it from the stack.

Syntax
$CompanyID = $self->popReturn( 'CompanyID' )
Input
$Key (string)
return value name
Return
$Value (string)
return value

pushID

Adds a named parameter value. This allows element handlers to pass information to the handler of sub elements.

Syntax
$self->pushID( 'CompanyID', $CompanyID )
Input
$Key (string)
parameter name
$Value (string)
parameter value

pushReturn

Adds a named return value. This allows handles for sub elemets to pass information to the handler of the outer element.

Syntax
$self->pushReturn( 'CompanyID', $CompanyID )
Input
$Key (string)
return value name
$Value (string)
return value

stackID

Returns the named parameter values. This allows element handlers to get information about top level identifier.

Syntax
my $raIDs = $self->stackID( 'CompanyID');
Input
$Key (string)
parameter name
Return
$raIDs (ref.array.string)
values

stackReturn

Returns the return added values.

Syntax
my $raReturns = $self->stackReturn( 'CompanyReturn');
Input
$Key (string)
parameter name
Return
$raReturns (ref.array.string)
values

topElement

Returns the currently processes XML element node.

Syntax
$Element = $self->topElement;
Return
$Element (string)
element object (first parameter of start_element)

topID

Returns the most recently added parameter but leaves it on the stack.

Syntax
$CompanyID = $self->topID( 'CompanyID' )
Input
$Key (string)
parameter name
Return
$Value (string)
parameter value

topReturn

Returns the most recently added value but leaves it on the stack.

Syntax
$CompanyID = $self->topReturn( 'CompanyID' )
Input
$Key (string)
return value name
Return
$Value (string)
return value

varsOnErrorString

Returns information about the current position in the XML file.

Syntax
$Position = $self->varsOnError();
$Position = $self->varsOnError( $Element );
Input
$Element (object)
(optional) XML element (parameter of start_element)
Return
$Position (string)
parser information including: FileName, Script, XMLPosition