|
Moodle
2.2.1
http://www.collinsharper.com
|

Public Member Functions | |
| __construct ($output, $contenttransformer=null, $casefolding=false) | |
| start () | |
| stop () | |
| set_nonamespace_schema ($uri) | |
| set_prologue ($prologue) | |
| begin_tag ($tag, $attributes=null) | |
| end_tag ($tag) | |
| full_tag ($tag, $content=null, $attributes=null) | |
Protected Member Functions | |
| write ($output) | |
| get_default_prologue () | |
| xml_safe_attr_content ($content) | |
| xml_safe_text_content ($content) | |
| xml_safe_utf8 ($content) | |
| text_content ($content) | |
Protected Attributes | |
| $output | |
| $contenttransformer | |
| $prologue | |
| $xmlschema | |
| $casefolding | |
| $level | |
| $opentags | |
| $lastwastext | |
| $nullcontent | |
| $running | |
Class implementing one (more or less complete) UTF-8 XML writer
General purpose class used to output UTF-8 XML contents easily. Can be customized using implementations of (to define where to send the xml) and and (to perform any transformation in contents before outputting the XML).
Has support for attributes, basic w3c xml schemas declaration, and performs some content cleaning to avoid potential incorret UTF-8 mess and has complete exception support.
TODO: Provide UTF-8 safe strtoupper() function if using casefolding and non-ascii tags/attrs names TODO: Finish phpdocs
Definition at line 40 of file xml_writer.class.php.
| __construct | ( | $ | output, |
| $ | contenttransformer = null, |
||
| $ | casefolding = false |
||
| ) |
Definition at line 57 of file xml_writer.class.php.
| begin_tag | ( | $ | tag, |
| $ | attributes = null |
||
| ) |
Outputs one XML start tag with optional attributes (name => value array)
Definition at line 142 of file xml_writer.class.php.


| end_tag | ( | $ | tag | ) |
Outputs one XML end tag
Definition at line 180 of file xml_writer.class.php.


| full_tag | ( | $ | tag, |
| $ | content = null, |
||
| $ | attributes = null |
||
| ) |
Outputs one tag completely (open, contents and close)
Definition at line 210 of file xml_writer.class.php.


| get_default_prologue | ( | ) | [protected] |
Get default prologue contents for this writer if there isn't a custom one
Reimplemented in mock_xml_writer.
Definition at line 234 of file xml_writer.class.php.

| set_nonamespace_schema | ( | $ | uri | ) |
Set the URI location for the *nonamespace* schema to be used by the (whole) XML document
Definition at line 122 of file xml_writer.class.php.
| set_prologue | ( | $ | prologue | ) |
Define the complete prologue to be used, replacing the simple, default one
Definition at line 132 of file xml_writer.class.php.
| start | ( | ) |
Initializes the XML writer, preparing it to accept instructions, also invoking the underlying init method to be ready for operation
Definition at line 85 of file xml_writer.class.php.

| stop | ( | ) |
Finishes the XML writer, not accepting instructions any more, also invoking the underlying finish method to close/flush everything as needed
Definition at line 105 of file xml_writer.class.php.
| text_content | ( | $ | content | ) | [protected] |
Returns text contents processed by the corresponding
Definition at line 271 of file xml_writer.class.php.


| write | ( | $ | output | ) | [protected] |
Send some XML formatted chunk to output.
Definition at line 227 of file xml_writer.class.php.

| xml_safe_attr_content | ( | $ | content | ) | [protected] |
Clean attribute content and encode needed chars (&, <, >, ") - single quotes not needed in this class as far as we are enclosing with "
Definition at line 243 of file xml_writer.class.php.


| xml_safe_text_content | ( | $ | content | ) | [protected] |
Clean text content and encode needed chars (&, <, >)
Definition at line 251 of file xml_writer.class.php.


| xml_safe_utf8 | ( | $ | content | ) | [protected] |
Perform some UTF-8 cleaning, stripping the control chars (-) but tabs (), newlines () and returns (). The delete control char () is also included. All them are forbiden in XML 1.0 specs. The expression below seems to be UTF-8 safe too because it simply ignores the rest of characters. Also normalize linefeeds and return chars.
Definition at line 262 of file xml_writer.class.php.

$casefolding [protected] |
Definition at line 48 of file xml_writer.class.php.
$contenttransformer [protected] |
Definition at line 43 of file xml_writer.class.php.
$lastwastext [protected] |
Definition at line 52 of file xml_writer.class.php.
$level [protected] |
Definition at line 50 of file xml_writer.class.php.
$nullcontent [protected] |
Definition at line 53 of file xml_writer.class.php.
$opentags [protected] |
Definition at line 51 of file xml_writer.class.php.
$output [protected] |
Definition at line 42 of file xml_writer.class.php.
$prologue [protected] |
Definition at line 45 of file xml_writer.class.php.
$running [protected] |
Definition at line 55 of file xml_writer.class.php.
$xmlschema [protected] |
Definition at line 46 of file xml_writer.class.php.