summaryrefslogtreecommitdiffstats
path: root/user_guide_src/source/helpers/xml_helper.rst
diff options
context:
space:
mode:
authorAndrew <browner12@gmail.com>2014-02-11 09:55:48 +0100
committerAndrew <browner12@gmail.com>2014-02-11 09:55:48 +0100
commitb6d8b962e44202a74c9b9321a4a53f61a753fccf (patch)
tree2d3c533a55964a0d124f7cd6bb1d3d98c7b84056 /user_guide_src/source/helpers/xml_helper.rst
parent41713aaa665189dd0a191c333c73c4a7b9f37c78 (diff)
parent29e12641a1bb952f493462db6757ae12c7da1f2c (diff)
Merge branch 'develop' into patch-1
Conflicts: system/libraries/Calendar.php
Diffstat (limited to 'user_guide_src/source/helpers/xml_helper.rst')
-rw-r--r--user_guide_src/source/helpers/xml_helper.rst43
1 files changed, 30 insertions, 13 deletions
diff --git a/user_guide_src/source/helpers/xml_helper.rst b/user_guide_src/source/helpers/xml_helper.rst
index be848bcd1..a40ea9ad3 100644
--- a/user_guide_src/source/helpers/xml_helper.rst
+++ b/user_guide_src/source/helpers/xml_helper.rst
@@ -5,7 +5,12 @@ XML Helper
The XML Helper file contains functions that assist in working with XML
data.
-.. contents:: Page Contents
+.. contents::
+ :local:
+
+.. raw:: html
+
+ <div class="custom-index container"></div>
Loading this Helper
===================
@@ -16,23 +21,35 @@ This helper is loaded using the following code
$this->load->helper('xml');
+Available Functions
+===================
+
The following functions are available:
-xml_convert()
-=====================
+.. function:: xml_convert($str[, $protect_all = FALSE])
-Takes a string as input and converts the following reserved XML
-characters to entities:
+ :param string $str: the text string to convert
+ :param bool $protect_all: Whether to protect all content that looks like a potential entity instead of just numbered entities, e.g. &foo;
+ :returns: XML-converted string
+ :rtype: string
-- Ampersands: &
-- Less then and greater than characters: < >
-- Single and double quotes: ' "
-- Dashes: -
+ Takes a string as input and converts the following reserved XML
+ characters to entities:
-This function ignores ampersands if they are part of existing character
-entities. Example
+ - Ampersands: &
+ - Less than and greater than characters: < >
+ - Single and double quotes: ' "
+ - Dashes: -
-::
+ This function ignores ampersands if they are part of existing numbered
+ character entities, e.g. &#123;. Example::
+
+ $string = '<p>Here is a paragraph & an entity (&#123;).</p>';
+ $string = xml_convert($string);
+ echo $string;
+
+ outputs:
- $string = xml_convert($string);
+ .. code-block:: html
+ &lt;p&gt;Here is a paragraph &amp; an entity (&#123;).&lt;/p&gt; \ No newline at end of file