This post provides information about the data types used in different elements of each feed schema are used to help control how the XML is written for output.
There are currently a number of common data types incorporated into the FeedWriter and FeedConstruct classes. Additional types are soon to be included to increase the amount of control you have over the output without having to make changes to the class files themselves.
Posts will also be included on the blog, and additional information in the Online Documentation to help explain the primary use of each data type, and which ones should be used to satisfy specific requirements, or to help resolve issues with character encoding.
The full list of supported data types can be viewed here.
In the FeedWriter class, the writeConstruct() function uses different functions from the XMLWriter depending on the data type for each element in a feed. CDATA being enabled or disabled in the feed also has an affect on the output. Depending on the combination of a data type, CDATA configuration and character encoding specified when configuring a feed determines the function writes the output. Some combinations will also include the use of the Php htmlentities() function to convert some characters before including in a feed.
Some of the common combinations and corresponding output methods are provided below, but more information will be included as additional data types are included.
Data Type | XMLWriter function used? | htmlentities() used? | notes |
string | writeCData() – if CDATA enabled | Yes | Char-set included if supplied to FeedWriter Constructor |
string | writeRaw() – if CDATA disabled | Yes | Char-set included if supplied to FeedWriter Constructor |
uri | writeRaw() | No | - |
writeCData() – if CDATA enabled | No | - | |
writeRaw() – if CDATA disabled | No | - | |
xml | writeRaw() | No | - |
html | writeCData() – Always uses CDATA | No | - |
date_iso | text() | No | outputs in ISO-8601 date format |
date_rcf | text() | No | outputs in RFC 2822 date format |
other | text() | No | - |