From e7dfb679cf4f1a683d837aaea94b5b5125204779 Mon Sep 17 00:00:00 2001 From: Derek Jones Date: Fri, 19 Jul 2013 14:16:56 -0700 Subject: updating XML helper docs --- user_guide_src/source/helpers/xml_helper.rst | 42 ++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 12 deletions(-) (limited to 'user_guide_src/source/helpers') diff --git a/user_guide_src/source/helpers/xml_helper.rst b/user_guide_src/source/helpers/xml_helper.rst index be848bcd1..681408e03 100644 --- a/user_guide_src/source/helpers/xml_helper.rst +++ b/user_guide_src/source/helpers/xml_helper.rst @@ -5,7 +5,9 @@ XML Helper The XML Helper file contains functions that assist in working with XML data. -.. contents:: Page Contents + +.. contents:: + :local: Loading this Helper =================== @@ -16,23 +18,39 @@ This helper is loaded using the following code $this->load->helper('xml'); +Available Functions +=================== + The following functions are available: + xml_convert() -===================== +------------- -Takes a string as input and converts the following reserved XML -characters to entities: +.. method:: xml_convert($str[, $protect_all = FALSE]) -- Ampersands: & -- Less then and greater than characters: < > -- Single and double quotes: ' " -- Dashes: - + :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: converted string + :rtype: string -This function ignores ampersands if they are part of existing character -entities. Example + Takes a string as input and converts the following reserved XML + characters to entities: -:: + - Ampersands: & + - Less then and greater than characters: < > + - Single and double quotes: ' " + - Dashes: - + + This function ignores ampersands if they are part of existing numbered + character entities, e.g. {. Example:: + + $string = '

Here is a paragraph & an entity ({).

'; + $string = xml_convert($string); + echo $string; + + outputs: - $string = xml_convert($string); + .. code-block:: html + <p>Here is a paragraph & an entity ({).</p> -- cgit v1.2.3-24-g4f1b