Output Data Types and Feed Configuration to help Control Output (HTML, CDATA, Encoding)

September 18th, 2011
by Daniel Soutter

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
email writeCData() – if CDATA enabled No
email 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

Tags: , , , ,
Posted in FeedWriter Class, getXML(), Uncategorized, writeConstruct(), __construct() | Comments (0)

  • Php FeedWriter (c) Copyright 2011 Daniel Soutter. Php FeedWriter and the information on this site has been designed to benefit website developers, owners and users, but may contain errors and is provided as is, with no warranty. Terms.