|
Moodle
2.2.1
http://www.collinsharper.com
|
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) | |
Custom XML parser class for signed and/or encrypted XML Docs
Definition at line 14 of file xmlparser.php.
| discard_data | ( | $ | parser, |
| $ | data | ||
| ) |
Discard the next chunk of character data
This is used for tags that we're not interested in.
| mixed | $parser | The XML parser |
| string | $data | The content of the current tag (1024 byte chunk) |
Definition at line 271 of file xmlparser.php.
| end_element | ( | $ | parser, |
| $ | name | ||
| ) |
Switch the character-data handler to ignore the next chunk of data
| mixed | $parser | The XML parser |
| string | $name | The name of the tag, e.g. method_call |
Definition at line 303 of file xmlparser.php.
| free_resource | ( | ) |
Destroy the parser and free up any related resource.
Definition at line 130 of file xmlparser.php.
| initialise | ( | ) |
Set default element handlers and initialise properties to empty.
Definition at line 29 of file xmlparser.php.

Constructor creates and initialises parser resource and calls initialise
Definition at line 20 of file xmlparser.php.

| 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 | | | | | | | |______________________| | | | | | | | | | | | |_____________________________| | | | |_____________________________________| | | | |________________________________________________|
| string | $data | The XML that you want to parse |
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.
| mixed | $parser | The XML parser |
| string | $data | The content of the current tag (1024 byte chunk) |
Definition at line 209 of file xmlparser.php.
| parse_digest | ( | $ | parser, |
| $ | data | ||
| ) |
Add the next chunk of character data to the digest string
| mixed | $parser | The XML parser |
| string | $data | The content of the current tag (1024 byte chunk) |
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
| mixed | $parser | The XML parser |
| string | $data | The content of the current tag (1024 byte chunk) |
Definition at line 257 of file xmlparser.php.
| parse_signature | ( | $ | parser, |
| $ | data | ||
| ) |
Add the next chunk of character data to the signature string
| mixed | $parser | The XML parser |
| string | $data | The content of the current tag (1024 byte chunk) |
Definition at line 245 of file xmlparser.php.
| parse_timestamp | ( | $ | parser, |
| $ | data | ||
| ) |
Add the next chunk of character data to the remote_timestamp string
| mixed | $parser | The XML parser |
| string | $data | The content of the current tag (1024 byte chunk) |
Definition at line 188 of file xmlparser.php.
| parse_wwwroot | ( | $ | parser, |
| $ | data | ||
| ) |
Add the next chunk of character data to the remote_wwwroot string
| mixed | $parser | The XML parser |
| string | $data | The content of the current tag (1024 byte chunk) |
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.
| mixed | $parser | The XML parser |
| string | $name | The name of the tag, e.g. method_call |
| array | $attrs | The tag's attributes (if any exist). |
Definition at line 146 of file xmlparser.php.