-
FAQ
- Forum Search
- Community
- Online Manual
- Support Helpers of the Month
- Function Database
cdata_parse
Description
Internal function used to enclose text strings in CDATA tags.
Syntax
string cdata_parse (string $data, string $ns)
Parameter $data
Expected type: String
Description: Either the text that should be enclosed in CDATA or one or more lines of a document (when adding a namespace)
Parameter $ns
Expected type: String
Description: The namespace to use for the document, if any
Return value
Expected type: String
Description: Returns the passed string enclosed in CDATA tags (with namespace added if ns was specified)
Notes
- Encloses strings in tags
- Looks for pre-defined entities (&, <, > and ') and moves them outside the CDATA sections to ensure they are parsed properly (see http://validator.w3.org/feed/docs/warning/ContainsHTML.html)
- Converts ] to an entity as well, since ] is illegal inside CDATA
- Can be used to add a namespace to an entire document or a single line within a document while also enclosing everything in CDATA
- Strips off empty CDATA sections at the end before returning string
Advertisement:- Help | Terms and Rules | Go Up ▲
- Copyright © 2022 Simple Machines. All Rights Reserved.
- Page created in 0.015 seconds with 13 queries.
- Forum Search