cvs: peardoc /en/package/xml/xml-feed-parser extensions.xml intro.xml
| From: | James Stewart | Date: | Sun, 08 Jan 2006 17:53:54 +0000 |
| Subject: | cvs: peardoc /en/package/xml/xml-feed-parser extensions.xml intro.xml | ||
| Groups: | php.pear.doc | ||
| Request: | Send a blank email to pear-doc+get-7432@lists.php.net to get a copy of this message | ||
jystewart Sun Jan 8 17:53:54 2006 UTC
Modified files:
/peardoc/en/package/xml/xml-feed-parser extensions.xml intro.xml
Log:
Improve nesting. Add in required variables.
http://cvs.php.net/viewcvs.cgi/peardoc/en/package/xml/xml-feed-parser/extensions.xml?r1=1.1&r2=1.2&diff_format=u Index: peardoc/en/package/xml/xml-feed-parser/extensions.xml diff -u peardoc/en/package/xml/xml-feed-parser/extensions.xml:1.1 peardoc/en/package/xml/xml-feed-parser/extensions.xml:1.2 --- peardoc/en/package/xml/xml-feed-parser/extensions.xml:1.1 Sat Jan 7 20:20:22 2006 +++ peardoc/en/package/xml/xml-feed-parser/extensions.xml Sun Jan 8 17:53:54 2006 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1" ?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <refentry id="package.xml.xml-feed-parser.extensions"> <refnamediv> @@ -9,25 +9,56 @@ <refsect1 id="package.xml.xml-feed-parser.intro.desc"> &title.desc; -<para>Using XML namespaces, the various syndication formats are very easy to extend and the number of extensions in use is enormous.</para> + <para>Using XML namespaces, the various syndication formats are very + easy to extend and the number of extensions in use is enormous.</para> -<para>XML_Feed_Parser focusses on core functionality shared between the various syndication formats. Some of the most common extensions are handled natively—particularly when they provide one format with features to bring it into line with others, such as the content extension for RSS2—but the majority provide specialist content and providing support for them would quickly result in a bloated package.</para> - -<para>It is possible that a proper extensions mechanism may be introduced in a future version, but as an alternative the DOM models in use within the classes are publicly accessible, allowing the package to be wrapped with special handlers.</para> - -<para>For example, to make use of the 'pheed' extension (namespace http://www.pheed.com/pheed/) we might use: <programlisting role="php"> + <para>XML_Feed_Parser focusses on core functionality shared between the + various syndication formats. Some of the most common extensions are + handled natively—particularly when they provide one format with + features to bring it into line with others, such as the content + extension for RSS2—but the majority provide specialist content and + providing support for them would quickly result in a bloated package. + </para> + + <para>It is possible that a proper extensions mechanism may be introduced + in a future version, but as an alternative the DOM models in use within the + classes are publicly accessible, allowing the package to be wrapped with + special handlers.</para> + + <para>For example, to make use of the 'pheed' extension (namespace + http://www.pheed.com/pheed/) we might use: +<programlisting role="php"> $feed = new XML_Feed_Parser($xml_source); $entry = $feed->getEntryByOffset(0); $eModel = $entry->model; $thumbnails = $eModel->getElementsByTagNameNS( - 'http://www.pheed.com/pheed/', 'thumbnail'); + 'http://www.pheed.com/pheed/', 'thumbnail'); if ($thumbnails->length) { - $thumbnail_url = $thumbnails->item(0)->nodeValue; + $thumbnail_url = $thumbnails->item(0)->nodeValue; } </programlisting> -</para> + </para> -</refsect1> + </refsect1> </refentry> +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:t +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +sgml-parent-document:nil +sgml-default-dtd-file:"../../../../manual.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:nil +sgml-local-ecat-files:nil +End: +vim600: syn=xml fen fdm=syntax fdl=2 si +vim: et tw=78 syn=sgml +vi: ts=1 sw=1 +--> http://cvs.php.net/viewcvs.cgi/peardoc/en/package/xml/xml-feed-parser/intro.xml?r1=1.1&r2=1.2&diff_format=u Index: peardoc/en/package/xml/xml-feed-parser/intro.xml diff -u peardoc/en/package/xml/xml-feed-parser/intro.xml:1.1 peardoc/en/package/xml/xml-feed-parser/intro.xml:1.2 --- peardoc/en/package/xml/xml-feed-parser/intro.xml:1.1 Sat Jan 7 20:20:22 2006 +++ peardoc/en/package/xml/xml-feed-parser/intro.xml Sun Jan 8 17:53:54 2006 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1" ?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <refentry id="package.xml.xml-feed-parser.intro"> <refnamediv> @@ -9,54 +9,76 @@ <refsect1 id="package.xml.xml-feed-parser.intro.desc"> &title.desc; - <para>XML_Feed_Parser provides a generic interface to a number of the most popular XML-based syndication formats (Atom, RSS1, RSS2, etc). In order to focus on its core competencies, it does not provide any HTTP or feed creation features, but instead parses a wide range of formats quickly and simply.</para> -<para> -Presuming the XML for a feed is stored in the variable $xml_source, the simplest way to create an instance of the parser is: + <para>XML_Feed_Parser provides a generic interface to a number of the + most popular XML-based syndication formats (Atom, RSS1, RSS2, etc). In + order to focus on its core competencies, it does not provide any HTTP or + feed creation features, but instead parses a wide range of formats quickly + and simply.</para> + + <para>Presuming the XML for a feed is stored in the variable + $xml_source, the simplest way to create an instance of the parser is: <programlisting role="php">try { - $feed = new XML_Feed_Parser($xml_source); + $feed = new XML_Feed_Parser($xml_source); } catch (XML_Feed_Parser_Exception $e) { - die('Feed invalid: ' . $e->getMessage()); + die('Feed invalid: ' . $e->getMessage()); }</programlisting> </para> -<para>The constructor accepts a number of parameters, as follows: + <para>The constructor accepts a number of parameters, as follows: <programlisting role="php"> - /* The file you wish to parse */ - $source = 'my_source.xml'; - - /* Where Relax NG is available, we can force validation of the feed */ - $validate = true; - - /* Whether or not to suppress non-fatal warnings */ - $suppress_warnings = false; - - /* If the feed is not valid XML and the tidy extension is installed we can - * attempt to use it to fix the feed */ - $use_tidy = true; + /* The file you wish to parse */ + $source = 'my_source.xml'; + + /* Where Relax NG is available, we can force validation of the feed */ + $validate = true; + + /* Whether or not to suppress non-fatal warnings */ + $suppress_warnings = false; + + /* If the feed is not valid XML and the tidy extension is installed we can + * attempt to use it to fix the feed */ + $use_tidy = true; - $feed = new XML_Feed_Parser($source, $validate, $suppress_warnings, $use_tidy);</programlisting> -</para> + $feed = new XML_Feed_Parser($source, $validate, $suppress_warnings, $use_tidy);</programlisting> + </para> -<para>Once you have an instance of the parser you can extract feed-level data by -querying it directly. eg. + <para>Once you have an instance of the parser you can extract + feed-level data by querying it directly. eg. <programlisting role="php">$title = $feed->title;</programlisting> -</para> + </para> -<para>You can also access elements by iterating over the feed, or directly by offset or id. + <para>You can also access elements by iterating over the feed, or + directly by offset or id. <programlisting role="php"> - foreach ($feed as $entry) { - print $entry->title . "\n"; - } - - $first_entry = $feed->getEntryByOffset(0); - - $particular_entry = $feed->getEntryById('http://jystewart.net/entry/1'); + foreach ($feed as $entry) { + print $entry->title . "\n"; + } + + $first_entry = $feed->getEntryByOffset(0); + + $particular_entry = $feed->getEntryById('http://jystewart.net/entry/1'); </programlisting> -</para> -<para> - -</para> -</refsect1> + </para> + </refsect1> </refentry> +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:t +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +sgml-parent-document:nil +sgml-default-dtd-file:"../../../../manual.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:nil +sgml-local-ecat-files:nil +End: +vim600: syn=xml fen fdm=syntax fdl=2 si +vim: et tw=78 syn=sgml +vi: ts=1 sw=1 +-->
http://cvs.php.net/viewcvs.cgi/peardoc/en/package/xml/xml-feed-parser/extensions.xml?r1=1.1&r2=1.2&diff_format=u Index: peardoc/en/package/xml/xml-feed-parser/extensions.xml diff -u peardoc/en/package/xml/xml-feed-parser/extensions.xml:1.1 peardoc/en/package/xml/xml-feed-parser/extensions.xml:1.2 --- peardoc/en/package/xml/xml-feed-parser/extensions.xml:1.1 Sat Jan 7 20:20:22 2006 +++ peardoc/en/package/xml/xml-feed-parser/extensions.xml Sun Jan 8 17:53:54 2006 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1" ?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <refentry id="package.xml.xml-feed-parser.extensions"> <refnamediv> @@ -9,25 +9,56 @@ <refsect1 id="package.xml.xml-feed-parser.intro.desc"> &title.desc; -<para>Using XML namespaces, the various syndication formats are very easy to extend and the number of extensions in use is enormous.</para> + <para>Using XML namespaces, the various syndication formats are very + easy to extend and the number of extensions in use is enormous.</para> -<para>XML_Feed_Parser focusses on core functionality shared between the various syndication formats. Some of the most common extensions are handled natively—particularly when they provide one format with features to bring it into line with others, such as the content extension for RSS2—but the majority provide specialist content and providing support for them would quickly result in a bloated package.</para> - -<para>It is possible that a proper extensions mechanism may be introduced in a future version, but as an alternative the DOM models in use within the classes are publicly accessible, allowing the package to be wrapped with special handlers.</para> - -<para>For example, to make use of the 'pheed' extension (namespace http://www.pheed.com/pheed/) we might use: <programlisting role="php"> + <para>XML_Feed_Parser focusses on core functionality shared between the + various syndication formats. Some of the most common extensions are + handled natively—particularly when they provide one format with + features to bring it into line with others, such as the content + extension for RSS2—but the majority provide specialist content and + providing support for them would quickly result in a bloated package. + </para> + + <para>It is possible that a proper extensions mechanism may be introduced + in a future version, but as an alternative the DOM models in use within the + classes are publicly accessible, allowing the package to be wrapped with + special handlers.</para> + + <para>For example, to make use of the 'pheed' extension (namespace + http://www.pheed.com/pheed/) we might use: +<programlisting role="php"> $feed = new XML_Feed_Parser($xml_source); $entry = $feed->getEntryByOffset(0); $eModel = $entry->model; $thumbnails = $eModel->getElementsByTagNameNS( - 'http://www.pheed.com/pheed/', 'thumbnail'); + 'http://www.pheed.com/pheed/', 'thumbnail'); if ($thumbnails->length) { - $thumbnail_url = $thumbnails->item(0)->nodeValue; + $thumbnail_url = $thumbnails->item(0)->nodeValue; } </programlisting> -</para> + </para> -</refsect1> + </refsect1> </refentry> +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:t +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +sgml-parent-document:nil +sgml-default-dtd-file:"../../../../manual.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:nil +sgml-local-ecat-files:nil +End: +vim600: syn=xml fen fdm=syntax fdl=2 si +vim: et tw=78 syn=sgml +vi: ts=1 sw=1 +--> http://cvs.php.net/viewcvs.cgi/peardoc/en/package/xml/xml-feed-parser/intro.xml?r1=1.1&r2=1.2&diff_format=u Index: peardoc/en/package/xml/xml-feed-parser/intro.xml diff -u peardoc/en/package/xml/xml-feed-parser/intro.xml:1.1 peardoc/en/package/xml/xml-feed-parser/intro.xml:1.2 --- peardoc/en/package/xml/xml-feed-parser/intro.xml:1.1 Sat Jan 7 20:20:22 2006 +++ peardoc/en/package/xml/xml-feed-parser/intro.xml Sun Jan 8 17:53:54 2006 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1" ?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <refentry id="package.xml.xml-feed-parser.intro"> <refnamediv> @@ -9,54 +9,76 @@ <refsect1 id="package.xml.xml-feed-parser.intro.desc"> &title.desc; - <para>XML_Feed_Parser provides a generic interface to a number of the most popular XML-based syndication formats (Atom, RSS1, RSS2, etc). In order to focus on its core competencies, it does not provide any HTTP or feed creation features, but instead parses a wide range of formats quickly and simply.</para> -<para> -Presuming the XML for a feed is stored in the variable $xml_source, the simplest way to create an instance of the parser is: + <para>XML_Feed_Parser provides a generic interface to a number of the + most popular XML-based syndication formats (Atom, RSS1, RSS2, etc). In + order to focus on its core competencies, it does not provide any HTTP or + feed creation features, but instead parses a wide range of formats quickly + and simply.</para> + + <para>Presuming the XML for a feed is stored in the variable + $xml_source, the simplest way to create an instance of the parser is: <programlisting role="php">try { - $feed = new XML_Feed_Parser($xml_source); + $feed = new XML_Feed_Parser($xml_source); } catch (XML_Feed_Parser_Exception $e) { - die('Feed invalid: ' . $e->getMessage()); + die('Feed invalid: ' . $e->getMessage()); }</programlisting> </para> -<para>The constructor accepts a number of parameters, as follows: + <para>The constructor accepts a number of parameters, as follows: <programlisting role="php"> - /* The file you wish to parse */ - $source = 'my_source.xml'; - - /* Where Relax NG is available, we can force validation of the feed */ - $validate = true; - - /* Whether or not to suppress non-fatal warnings */ - $suppress_warnings = false; - - /* If the feed is not valid XML and the tidy extension is installed we can - * attempt to use it to fix the feed */ - $use_tidy = true; + /* The file you wish to parse */ + $source = 'my_source.xml'; + + /* Where Relax NG is available, we can force validation of the feed */ + $validate = true; + + /* Whether or not to suppress non-fatal warnings */ + $suppress_warnings = false; + + /* If the feed is not valid XML and the tidy extension is installed we can + * attempt to use it to fix the feed */ + $use_tidy = true; - $feed = new XML_Feed_Parser($source, $validate, $suppress_warnings, $use_tidy);</programlisting> -</para> + $feed = new XML_Feed_Parser($source, $validate, $suppress_warnings, $use_tidy);</programlisting> + </para> -<para>Once you have an instance of the parser you can extract feed-level data by -querying it directly. eg. + <para>Once you have an instance of the parser you can extract + feed-level data by querying it directly. eg. <programlisting role="php">$title = $feed->title;</programlisting> -</para> + </para> -<para>You can also access elements by iterating over the feed, or directly by offset or id. + <para>You can also access elements by iterating over the feed, or + directly by offset or id. <programlisting role="php"> - foreach ($feed as $entry) { - print $entry->title . "\n"; - } - - $first_entry = $feed->getEntryByOffset(0); - - $particular_entry = $feed->getEntryById('http://jystewart.net/entry/1'); + foreach ($feed as $entry) { + print $entry->title . "\n"; + } + + $first_entry = $feed->getEntryByOffset(0); + + $particular_entry = $feed->getEntryById('http://jystewart.net/entry/1'); </programlisting> -</para> -<para> - -</para> -</refsect1> + </para> + </refsect1> </refentry> +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:t +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +sgml-parent-document:nil +sgml-default-dtd-file:"../../../../manual.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:nil +sgml-local-ecat-files:nil +End: +vim600: syn=xml fen fdm=syntax fdl=2 si +vim: et tw=78 syn=sgml +vi: ts=1 sw=1 +-->