Moodle  2.2.1
http://www.collinsharper.com
mnet_encxml_parser Class Reference

Public Member Functions

 mnet_encxml_parser ()
 initialise ()
 parse ($data)
 free_resource ()
 start_element ($parser, $name, $attrs)
 parse_timestamp ($parser, $data)
 parse_cipher ($parser, $data)
 parse_wwwroot ($parser, $data)
 parse_digest ($parser, $data)
 parse_signature ($parser, $data)
 parse_object ($parser, $data)
 discard_data ($parser, $data)
 parse_fault ($parser, $data)
 end_element ($parser, $name)

Detailed Description

Custom XML parser class for signed and/or encrypted XML Docs

Definition at line 14 of file xmlparser.php.


Member Function Documentation

discard_data ( parser,
data 
)

Discard the next chunk of character data

This is used for tags that we're not interested in.

Parameters:
mixed$parserThe XML parser
string$dataThe content of the current tag (1024 byte chunk)
Returns:
bool True

Definition at line 271 of file xmlparser.php.

end_element ( parser,
name 
)

Switch the character-data handler to ignore the next chunk of data

Parameters:
mixed$parserThe XML parser
string$nameThe name of the tag, e.g. method_call
Returns:
bool True

Definition at line 303 of file xmlparser.php.

Destroy the parser and free up any related resource.

Definition at line 130 of file xmlparser.php.

Set default element handlers and initialise properties to empty.

Returns:
bool True

Definition at line 29 of file xmlparser.php.

Here is the caller graph for this function:

Constructor creates and initialises parser resource and calls initialise

Returns:
bool True

Definition at line 20 of file xmlparser.php.

Here is the call graph for this function:

parse ( data)

Parse a block of XML text

The XML Text will be an XML-RPC request which is wrapped in an XML doc with a signature from the sender. This envelope may be encrypted and delivered within another XML envelope with a symmetric key. The parser should first decrypt this XML, and then place the XML-RPC request into the data_object property, and the signature into the signature property.

See the W3C's XML Encryption Syntax and Processing and XML-Signature Syntax and Processing guidelines for more detail on the XML.

-----XML-Envelope--------------------------------- | | | Symmetric-key-------------------------- | | |_____________________________________| | | | | Encrypted data------------------------- | | | | | | | -XML-Envelope------------------ | | | | | | | | | | | --Signature------------- | | | | | | |______________________| | | | | | | | | | | | | --Signed-Payload-------- | | | | | | | | | | | | | | | XML-RPC Request | | | | | | | |______________________| | | | | | | | | | | | |_____________________________| | | | |_____________________________________| | | | |________________________________________________|

Parameters:
string$dataThe XML that you want to parse
Returns:
bool True on success - false on failure

Definition at line 89 of file xmlparser.php.

parse_cipher ( parser,
data 
)

Add the next chunk of character data to the cipher string for that tag

The XML parser calls the character-data handler with 1024-character chunks of data. This means that the handler may be called several times for a single tag, so we use the concatenate operator (.) to build the tag content into a string. We should not encounter more than one of each tag type, except for the cipher tag. We will often see two of those. We prevent the content of these two tags being concatenated together by counting each tag, and using its 'number' as the key to an array of ciphers.

Parameters:
mixed$parserThe XML parser
string$dataThe content of the current tag (1024 byte chunk)
Returns:
bool True

Definition at line 209 of file xmlparser.php.

parse_digest ( parser,
data 
)

Add the next chunk of character data to the digest string

Parameters:
mixed$parserThe XML parser
string$dataThe content of the current tag (1024 byte chunk)
Returns:
bool True

Definition at line 233 of file xmlparser.php.

parse_fault ( parser,
data 
)

Definition at line 291 of file xmlparser.php.

parse_object ( parser,
data 
)

Add the next chunk of character data to the data_object string

Parameters:
mixed$parserThe XML parser
string$dataThe content of the current tag (1024 byte chunk)
Returns:
bool True

Definition at line 257 of file xmlparser.php.

parse_signature ( parser,
data 
)

Add the next chunk of character data to the signature string

Parameters:
mixed$parserThe XML parser
string$dataThe content of the current tag (1024 byte chunk)
Returns:
bool True

Definition at line 245 of file xmlparser.php.

parse_timestamp ( parser,
data 
)

Add the next chunk of character data to the remote_timestamp string

Parameters:
mixed$parserThe XML parser
string$dataThe content of the current tag (1024 byte chunk)
Returns:
bool True

Definition at line 188 of file xmlparser.php.

parse_wwwroot ( parser,
data 
)

Add the next chunk of character data to the remote_wwwroot string

Parameters:
mixed$parserThe XML parser
string$dataThe content of the current tag (1024 byte chunk)
Returns:
bool True

Definition at line 221 of file xmlparser.php.

start_element ( parser,
name,
attrs 
)

Set the character-data handler to the right function for each element

For each tag (element) name, this function switches the character-data handler to the function that handles that element. Note that character data is referred to the handler in blocks of 1024 bytes.

Parameters:
mixed$parserThe XML parser
string$nameThe name of the tag, e.g. method_call
array$attrsThe tag's attributes (if any exist).
Returns:
bool True

Definition at line 146 of file xmlparser.php.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations