## Apache Zeta Components Manual :: File Source for rss2.php

## Source for file rss2.php

Documentation is available at rss2.php

1. <?php
2. /**
3. * File containing the ezcFeedRss2 class.
4. *
5. * Licensed to the Apache Software Foundation (ASF) under one
6. * or more contributor license agreements. See the NOTICE file
7. * distributed with this work for additional information
8. * regarding copyright ownership. The ASF licenses this file
9. * to you under the Apache License, Version 2.0 (the
10. * "License"); you may not use this file except in compliance
11. * with the License. You may obtain a copy of the License at
12. *
13. * http://www.apache.org/licenses/LICENSE-2.0
14. *
15. * Unless required by applicable law or agreed to in writing,
16. * software distributed under the License is distributed on an
17. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18. * KIND, either express or implied. See the License for the
19. * specific language governing permissions and limitations
20. * under the License.
21. *
22. * @package Feed
23. * @version //autogentag//
24. * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
25. * @filesource
26. */
28. /**
29. * Class providing parsing and generating of RSS2 feeds.
30. *
31. * Specifications:
32. * {@link http://www.rssboard.org/rss-specification RSS2 Specifications}.
33. *
34. * @package Feed
35. * @version //autogentag//
36. */
37. class ezcFeedRss2 extends ezcFeedProcessor implements ezcFeedParser
38. {
39. /**
40. * Defines the feed type of this processor.
41. */
42. const FEED_TYPE = 'rss2';
44. /**
45. * Defines the feed content type of this processor.
46. */
47. const CONTENT_TYPE = 'application/rss+xml';
49. /**
50. * Creates a new RSS2 processor.
51. *
52. * @param ezcFeed $container The feed data container used when generating
53. */
54. public function __construct ( ezcFeed $container )
55. {
56. $this->feedContainer = $container;
57. $this->feedType = self::FEED_TYPE;
58. $this->contentType = self::CONTENT_TYPE;
60. // initialize docs and pubDate with default values
61. if ( !isset( $this->docs ) )
62. {
63. $this->docs = 'http://www.rssboard.org/rss-specification';
64. }
66. if ( !isset( $this->published ) )
67. {
68. $this->published = time ();
69. }
70. }
72. /**
73. * Returns an XML string from the feed information contained in this
74. * processor.
75. *
76. * @return string
77. */
78. public function generate ()
79. {
80. $this->xml = new DOMDocument( '1.0', 'utf-8' );
81. $this->xml->formatOutput = 1;
83. $rss = $this->xml->createElement( 'rss' );
85. $rssVersionTag = $this->xml->createAttribute( 'version' );
86. $rssVersionContent = $this->xml->createTextNode( '2.0' );
87. $rssVersionTag->appendChild( $rssVersionContent );
88. $rss->appendChild( $rssVersionTag );
90. $this->channel = $this->xml->createElement( 'channel' );
91. $rss->appendChild( $this->channel );
92. $this->root = $this->xml->appendChild( $rss );
94. $this->generateRequired();
95. $this->generateOptional();
96. $this->generateFeedModules( $this->channel );
97. $this->generateItems();
99. return $this->xml->saveXML();
100. }
102. /**
103. * Returns true if the parser can parse the provided XML document object,
104. * false otherwise.
105. *
106. * @param DOMDocument $xml The XML document object to check for parseability
107. * @return bool
108. */
109. public static function canParse ( DOMDocument $xml )
110. {
111. if ( $xml->documentElement->tagName !== 'rss' )
112. {
113. return false;
114. }
115. if ( !$xml->documentElement->hasAttribute( 'version' ) )
116. {
117. return false;
118. }
119. if ( ! in_array ( $xml->documentElement->getAttribute( 'version' ), array( '0.91', '0.92', '0.93', '0.94', '2.0' ) ) )
120. {
121. return false;
122. }
123. return true;
124. }
126. /**
127. * Parses the provided XML document object and returns an ezcFeed object
128. * from it.
129. *
130. * @throws ezcFeedParseErrorException
131. * If an error was encountered during parsing.
132. *
133. * @param DOMDocument $xml The XML document object to parse
134. * @return ezcFeed
135. */
136. public function parse ( DOMDocument $xml )
137. {
138. $feed = new ezcFeed ( self::FEED_TYPE );
139. $rssChildren = $xml->documentElement->childNodes;
140. $channel = null;
142. $this->usedPrefixes = $this->fetchUsedPrefixes( $xml );
144. foreach ( $rssChildren as $rssChild )
145. {
146. if ( $rssChild->nodeType === XML_ELEMENT_NODE
147. && $rssChild->tagName === 'channel' )
148. {
149. $channel = $rssChild;
150. }
151. }
153. if ( $channel === null )
154. {
155. throw new ezcFeedParseErrorException ( null, "No channel tag" );
156. }
158. foreach ( $channel->childNodes as $channelChild )
159. {
160. if ( $channelChild->nodeType == XML_ELEMENT_NODE )
161. {
162. $tagName = $channelChild->tagName;
164. switch ( $tagName )
165. {
166. case 'title':
167. case 'description':
168. case 'copyright':
169. $element = $feed->add( $tagName );
170. $element->text = $channelChild->textContent;
171. break;
173. case 'language':
174. case 'ttl':
175. case 'docs':
176. case 'rating':
177. $element = $feed->add( $tagName );
178. $element->text = $channelChild->textContent;
179. break;
181. case 'generator':
182. $element = $feed->add( $tagName );
183. $element->name = $channelChild->textContent;
184. break;
186. case 'managingEditor':
187. $element = $feed->add( 'author' );
188. $element->name = $channelChild->textContent;
189. // @todo parse $name to see if it has the structure
190. // email@address (name) to fill the ->email field from it
191. break;
193. case 'webMaster':
194. $element = $feed->add( 'webMaster' );
195. $element->name = $channelChild->textContent;
196. // @todo parse $name to see if it has the structure
197. // email@address (name) to fill the ->email field from it
198. break;
200. case 'category':
201. $element = $feed->add( $tagName );
202. $element->term = $channelChild->textContent;
203. if ( $channelChild->hasAttribute( 'domain' ) )
204. {
205. $element->scheme = $channelChild->getAttribute( 'domain' );
206. }
207. break;
209. case 'link':
210. $element = $feed->add( $tagName );
211. $element->href = $channelChild->textContent;
212. break;
214. case 'cloud':
215. $element = $feed->add( $tagName );
217. $attributes = array( 'domain' => 'domain', 'port' => 'port', 'path' => 'path',
218. 'registerProcedure' => 'registerProcedure', 'protocol' => 'protocol' );
219. foreach ( $attributes as $name => $alias )
220. {
221. if ( $channelChild->hasAttribute( $name ) )
222. {
223. $element->$alias = $channelChild->getAttribute( $name );
224. }
225. }
226. break;
228. case 'pubDate':
229. $feed->published = $channelChild->textContent;
230. break;
232. case 'lastBuildDate':
233. $feed->updated = $channelChild->textContent;
234. break;
236. case 'item':
237. $element = $feed->add( $tagName );
238. $this->parseItem( $element, $channelChild );
239. break;
241. case 'image':
242. $image = $feed->add( 'image' );
243. $this->parseImage( $image, $channelChild );
244. break;
246. case 'skipHours':
247. $element = $feed->add( $tagName );
248. $this->parseSkipHours( $element, $channelChild );
249. break;
251. case 'skipDays':
252. $element = $feed->add( $tagName );
253. $this->parseSkipDays( $element, $channelChild );
254. break;
256. case 'textInput':
257. $element = $feed->add( $tagName );
258. $this->parseTextInput( $element, $channelChild );
259. break;
261. default:
262. // check if it's part of a known module/namespace
263. $this->parseModules( $feed, $channelChild, $tagName );
264. }
265. }
266. }
267. return $feed;
268. }
270. /**
271. * Adds the required feed elements to the XML document being generated.
272. */
273. private function generateRequired()
274. {
275. $elements = array( 'title', 'link', 'description' );
276. foreach ( $elements as $element )
277. {
278. $data = $this->$element;
279. if ( is_null ( $data ) )
280. {
281. throw new ezcFeedRequiredMetaDataMissingException ( "/{$this->root->nodeName}/{$element}

" );
- }
- if ( ! is_array ( $data ) )
- {
- $data = array( $data );
- }
- switch ( $element )
- {
- case 'link':
- foreach ( $data as $dataNode )
- {
- $this->generateMetaData( $this->channel, $element, $dataNode->href );
- }
- break;
- default:
- foreach ( $data as $dataNode )
- {
- $this->generateMetaData( $this->channel, $element, $dataNode );
- }
- break;
- }
- }
- }
- /**
- * Adds the optional feed elements to the XML document being generated.
- */
- private function generateOptional()
- {
- $elements = array( 'language', 'copyright', 'author',
- 'webMaster', 'published', 'updated',
- 'category', 'generator', 'docs',
- 'ttl', 'image', 'rating',
- 'textInput', 'skipHours', 'skipDays',
- 'cloud', 'id' );
- foreach ( $elements as $element )
- {
- $data = $this->$element;
- if ( ! is_null ( $data ) )
- {
- switch ( $element )
- {
- case 'updated':
- $this->generateMetaData( $this->channel, 'lastBuildDate', $data->date->format( 'D, d M Y H:i:s O' ) );
- break;
- case 'published':
- $this->generateMetaData( $this->channel, 'pubDate', $data->date->format( 'D, d M Y H:i:s O' ) );
- break;
- case 'image':
- $this->generateImage( $this->image );
- break;
- case 'skipHours':
- $this->generateSkipHours( $this->skipHours );
- break;
- case 'skipDays':
- $this->generateSkipDays( $this->skipDays );
- break;
- case 'textInput':
- $this->generateTextInput( $this->textInput );
- break;
- case 'cloud':
- $this->generateCloud( $this->cloud );
- break;
- case 'category':
- foreach ( $this->category as $category )
- {
- $this->generateCategory( $category, $this->channel );
- }
- break;
- case 'generator':
- $this->generateGenerator( $data, $this->channel );
- break;
- case 'author':
- foreach ( $this->author as $person )
- {
- $this->generatePerson( $person, $this->channel, 'managingEditor' );
- }
- break;
- case 'webMaster':
- foreach ( $this->webMaster as $person )
- {
- $this->generatePerson( $person, $this->channel, 'webMaster' );
- }
- break;
- case 'id':
- $this->generateAtomSelfLink( $this->id );
- break;
- default:
- if ( ! is_array ( $data ) )
- {
- $data = array( $data );
- }
- foreach ( $data as $dataNode )
- {
- $this->generateMetaData( $this->channel, $element, $dataNode );
- }
- break;
- }
- }
- }
- }
- /**
- * Adds a category node to the XML document being generated.
- *
- * @param ezcFeedCategoryElement $category The category feed element
- * @param DOMElement $root The XML element where to store the category element
- */
- private function generateCategory( ezcFeedCategoryElement $category, DOMElement $root )
- {
- $data = $category->term;
- $element = $this->xml->createElement( 'category', $data );
- $root->appendChild( $element );
- $data = $category->scheme;
- if ( ! is_null ( $data ) )
- {
- $this->addAttribute( $element, 'domain', $data );
- }
- }
- /**
- * Adds a person node to the XML document being generated.
- *
- * @param ezcFeedPersonElement $person The person feed element
- * @param DOMElement $root The XML element where to store the person element
- * @param string $elementName The feed element name (eg 'author')
- */
- private function generatePerson( ezcFeedPersonElement $person, DOMElement $root, $elementName )
- {
- $name = $person->name;
- $email = $person->email;
- $data = $name;
- if ( $email !== null )
- {
- $data = "{$email} ({$name})";
- }
- $element = $this->xml->createElement( $elementName, $data );
- $root->appendChild( $element );
- }
- /**
- * Adds a generator node to the XML document being generated.
- *
- * @param ezcFeedGeneratorElement $generator The generator feed element
- * @param DOMElement $root The XML element where to store the generator element
- */
- private function generateGenerator( ezcFeedGeneratorElement $generator, DOMElement $root )
- {
- $name = $generator->name;
- $version = $generator->version;
- $url = $generator->url;
- $data = $name;
- if ( $version !== null )
- {
- $data = $data . " {$version}";
- }
- if ( $url !== null )
- {
- $data = $data . " ({$url})";
- }
- $element = $this->xml->createElement( 'generator', $data );
- $root->appendChild( $element );
- }
- /**
- * Adds an image node to the XML document being generated.
- *
- * @param ezcFeedImageElement $feedElement The image feed element
- */
- private function generateImage( ezcFeedImageElement $feedElement )
- {
- $image = $this->xml->createElement( 'image' );
- $this->channel->appendChild( $image );
- $elements = array( 'url', 'title', 'link' );
- foreach ( $elements as $element )
- {
- $data = $feedElement->$element;
- if ( is_null ( $data ) )
- {
- throw new ezcFeedRequiredMetaDataMissingException ( "/{$this->root->nodeName}/image/{$element}" );
- }
- $this->generateMetaData( $image, $element, $data );
- }
- $elements = array( 'description', 'width', 'height' );
- foreach ( $elements as $element )
- {
- $data = $feedElement->$element;
- if ( ! is_null ( $data ) )
- {
- $this->generateMetaData( $image, $element, $data );
- }
- }
- }
- /**
- * Adds a skipHours node to the XML document being generated.
- *
- * @param ezcFeedSkipHoursElement $feedElement The skipHours feed element
- */
- private function generateSkipHours( ezcFeedSkipHoursElement $feedElement )
- {
- $tag = $this->xml->createElement( 'skipHours' );
- $this->channel->appendChild( $tag );
- $data = $feedElement->hours;
- if ( ! is_null ( $data ) )
- {
- foreach ( $data as $dataNode )
- {
- $this->generateMetaData( $tag, 'hour', $dataNode );
- }
- }
- }
- /**
- * Adds a skipDays node to the XML document being generated.
- *
- * @param ezcFeedSkipDaysElement $feedElement The skipDays feed element
- */
- private function generateSkipDays( ezcFeedSkipDaysElement $feedElement )
- {
- $tag = $this->xml->createElement( 'skipDays' );
- $this->channel->appendChild( $tag );
- $data = $feedElement->days;
- if ( ! is_null ( $data ) )
- {
- foreach ( $data as $dataNode )
- {
- $this->generateMetaData( $tag, 'day', $dataNode );
- }
- }
- }
- /**
- * Adds an textInput node to the XML document being generated.
- *
- * @param ezcFeedTextInputElement $feedElement The textInput feed element
- */
- private function generateTextInput( ezcFeedTextInputElement $feedElement )
- {
- $image = $this->xml->createElement( 'textInput' );
- $this->channel->appendChild( $image );
- $elements = array( 'title', 'description', 'name', 'link' );
- foreach ( $elements as $element )
- {
- $data = $feedElement->$element;
- if ( is_null ( $data ) )
- {
- throw new ezcFeedRequiredMetaDataMissingException ( "/{$this->root->nodeName}/textInput/{$element}" );
- }
- $this->generateMetaData( $image, $element, $data );
- }
- }
- /**
- * Adds a cloud node to the XML document being generated.
- *
- * @param ezcFeedCloudElement $feedElement The cloud feed element
- */
- private function generateCloud( ezcFeedCloudElement $feedElement )
- {
- $attributes = array();
- $elements = array( 'domain', 'port', 'path', 'registerProcedure', 'protocol' );
- foreach ( $elements as $element )
- {
- $data = $feedElement->$element;
- if ( is_null ( $data ) )
- {
- throw new ezcFeedRequiredMetaDataMissingException ( "/{$this->root->nodeName}/cloud/{$element}" );
- }
- $attributes[$element] = $data;
- }
- $this->generateMetaDataWithAttributes( $this->channel, 'cloud', false, $attributes );
- }
- /**
- * Adds an atom:link node to the XML document being generated, plus the namespace.
- *
- * @param ezcFeedIdElement $feedElement The link feed element
- */
- private function generateAtomSelfLink( ezcFeedIdElement $feedElement )
- {
- $this->addAttribute( $this->root, 'xmlns:atom', ezcFeedAtom ::NAMESPACE_URI );
- $link = $this->xml->createElement( 'atom:link' );
- $this->channel->appendChild( $link );
- $this->addAttribute( $link, 'href', $feedElement->id );
- $this->addAttribute( $link, 'rel', 'self' );
- $this->addAttribute( $link, 'type', self::CONTENT_TYPE );
- }
- /**
- * Adds the feed items to the XML document being generated.
- */
- private function generateItems()
- {
- $items = $this->item;
- if ( $items === null )
- {
- return;
- }
- foreach ( $items as $item )
- {
- $itemTag = $this->xml->createElement( 'item' );
- $this->channel->appendChild( $itemTag );
- $atLeastOneRequiredFeedItemPresent = false;
- $elements = array( 'title', 'description' );
- foreach ( $elements as $attribute )
- {
- $data = $item->$attribute;
- if ( ! is_null ( $data ) )
- {
- $atLeastOneRequiredFeedItemPresent = true;
- break;
- }
- }
- if ( $atLeastOneRequiredFeedItemPresent === false )
- {
- $requiredElements = $elements;
- for ( $i = 0; $i < count ( $requiredElements ); $i++ )
- {
- $requiredElements[$i] = "/{$this->root->nodeName}/item/{$requiredElements[$i]}";
- }
- throw new ezcFeedAtLeastOneItemDataRequiredException ( $requiredElements );
- }
- $optional = array( 'title', 'link', 'description',
- 'author', 'category', 'comments',
- 'enclosure', 'id', 'published',
- 'source', 'language' );
- foreach ( $optional as $attribute )
- {
- $metaData = $item->$attribute;
- if ( ! is_null ( $metaData ) )
- {
- switch ( $attribute )
- {
- case 'comments':
- $this->generateMetaData( $itemTag, 'comments', $metaData );
- break;
- case 'id':
- $attributes = array();
- if ( isset( $metaData->isPermaLink ) )
- {
- $permaLink = ( $metaData->isPermaLink === true ) ? 'true' : 'false';
- $attributes = array( 'isPermaLink' => $permaLink );
- }
- $this->generateMetaDataWithAttributes( $itemTag, 'guid', $metaData->id, $attributes );
- break;
- case 'category':
- foreach ( $metaData as $dataNode )
- {
- $this->generateCategory( $dataNode, $itemTag );
- }
- break;
- case 'author':
- foreach ( $metaData as $person )
- {
- $this->generatePerson( $person, $itemTag, 'author' );
- }
- break;
- case 'published':
- $this->generateMetaData( $itemTag, 'pubDate', $metaData->date->format( 'D, d M Y H:i:s O' ) );
- break;
- case 'enclosure':
- foreach ( $metaData as $dataNode )
- {
- $attributes = array();
- $elements = array( 'url', 'length', 'type' );
- foreach ( $elements as $key )
- {
- if ( isset( $dataNode->$key ) )
- {
- $attributes[$key] = $dataNode->$key;
- }
- }
- $this->generateMetaDataWithAttributes( $itemTag, 'enclosure', false, $attributes );
- }
- break;
- case 'source':
- if ( !isset( $metaData->url ) )
- {
- throw new ezcFeedRequiredMetaDataMissingException ( '/rss/item/source/@url' );
- }
- $attributes = array( 'url' => $metaData->url );
- $this->generateMetaDataWithAttributes( $itemTag, 'source', $metaData, $attributes );
- break;
- case 'language':
- $this->addAttribute( $itemTag, 'xml:lang', $metaData );
- break;
- default:
- $this->generateMetaData( $itemTag, $attribute, $metaData );
- }
- }
- }
- $this->generateItemModules( $item, $itemTag );
- }
- }
- /**
- * Parses the provided XML element object and stores it as a feed item in
- * the provided ezcFeed object.
- *
- * @param ezcFeedElement $element The feed element object that will contain the feed item
- * @param DOMElement $xml The XML element object to parse
- */
- private function parseItem( ezcFeedElement $element, DOMElement $xml )
- {
- foreach ( $xml->childNodes as $itemChild )
- {
- if ( $itemChild->nodeType === XML_ELEMENT_NODE )
- {
- $tagName = $itemChild->tagName;
- switch ( $tagName )
- {
- case 'title':
- case 'description':
- case 'comments':
- $subElement = $element->add( $tagName );
- $subElement->text = $itemChild->textContent;
- break;
- case 'author':
- $subElement = $element->add( $tagName );
- $subElement->name = $itemChild->textContent;
- // @todo parse textContent if it has the format: email@host (name)
- break;
- case 'pubDate':
- $element->published = $itemChild->textContent;
- break;
- case 'enclosure':
- $subElement = $element->add( $tagName );
- $attributes = array( 'url' => 'url', 'type' => 'type', 'length' => 'length' );
- foreach ( $attributes as $name => $alias )
- {
- if ( $itemChild->hasAttribute( $name ) )
- {
- $subElement->$alias = $itemChild->getAttribute( $name );
- }
- }
- break;
- case 'link':
- $subElement = $element->add( $tagName );
- $subElement->href = $itemChild->textContent;
- break;
- case 'source':
- $subElement = $element->add( $tagName );
- $subElement->source = $itemChild->textContent;
- if ( $itemChild->hasAttribute( 'url' ) )
- {
- $subElement->url = $itemChild->getAttribute( 'url' );
- }
- break;
- case 'category':
- $subElement = $element->add( $tagName );
- $subElement->term = $itemChild->textContent;
- if ( $itemChild->hasAttribute( 'domain' ) )
- {
- $subElement->scheme = $itemChild->getAttribute( 'domain' );
- }
- break;
- case 'guid':
- $subElement = $element->add( 'id' );
- $subElement->id = $itemChild->textContent;
- if ( $itemChild->hasAttribute( 'isPermaLink' ) )
- {
- $value = $itemChild->getAttribute( 'isPermaLink' );
- $subElement->isPermaLink = ( strtolower ( $value ) === 'true' ) ? true : false;
- }
- break;
- default:
- // check if it's part of a known module/namespace
- $this->parseModules( $element, $itemChild, $tagName );
- break;
- }
- }
- }
- if ( $xml->hasAttribute( 'xml:lang' ) )
- {
- $element->language = $xml->getAttribute( 'xml:lang' );
- }
- }
- /**
- * Parses the provided XML element object and stores it as a feed image in
- * the provided ezcFeedImageElement object.
- *
- * @param ezcFeedImageElement $element The feed element object that will contain the feed image
- * @param DOMElement $xml The XML element object to parse
- */
- private function parseImage( ezcFeedImageElement $element, DOMElement $xml )
- {
- foreach ( $xml->childNodes as $itemChild )
- {
- if ( $itemChild->nodeType === XML_ELEMENT_NODE )
- {
- $tagName = $itemChild->tagName;
- switch ( $tagName )
- {
- case 'title':
- case 'link':
- case 'url':
- case 'description':
- case 'width':
- case 'height':
- $element->$tagName = $itemChild->textContent;
- break;
- }
- }
- }
- }
- /**
- * Parses the provided XML element object and stores it as a feed element
- * of type skipHours in the provided ezcFeedSkipHoursElement object.
- *
- * @param ezcFeedSkipHoursElement $element The feed element object that will contain skipHours
- * @param DOMElement $xml The XML element object to parse
- */
- private function parseSkipHours( ezcFeedSkipHoursElement $element, DOMElement $xml )
- {
- $values = array();
- foreach ( $xml->childNodes as $itemChild )
- {
- if ( $itemChild->nodeType === XML_ELEMENT_NODE )
- {
- $tagName = $itemChild->tagName;
- if ( $tagName === 'hour' )
- {
- $values[] = $itemChild->textContent;
- }
- }
- }
- $element->hours = $values;
- }
- /**
- * Parses the provided XML element object and stores it as a feed element
- * of type skipDays in the provided ezcFeedSkipDaysElement object.
- *
- * @param ezcFeedSkipDaysElement $element The feed element object that will contain skipDays
- * @param DOMElement $xml The XML element object to parse
- */
- private function parseSkipDays( ezcFeedSkipDaysElement $element, DOMElement $xml )
- {
- $values = array();
- foreach ( $xml->childNodes as $itemChild )
- {
- if ( $itemChild->nodeType === XML_ELEMENT_NODE )
- {
- $tagName = $itemChild->tagName;
- if ( $tagName === 'day' )
- {
- $values[] = $itemChild->textContent;
- }
- }
- }
- $element->days = $values;
- }
- /**
- * Parses the provided XML element object and stores it as a textInput in
- * the provided ezcFeedTextInputElement object.
- *
- * @param ezcFeedTextInputElement $element The feed element object that will contain the textInput
- * @param DOMElement $xml The XML element object to parse
- */
- private function parseTextInput( ezcFeedTextInputElement $element, DOMElement $xml )
- {
- foreach ( $xml->childNodes as $itemChild )
- {
- if ( $itemChild->nodeType === XML_ELEMENT_NODE )
- {
- $tagName = $itemChild->tagName;
- switch ( $tagName )
- {
- case 'title':
- case 'description':
- case 'name':
- case 'link':
- $element->$tagName = $itemChild->textContent;
- break;
- }
- }
- }
- }
- }
- ?>
Documentation generated by phpDocumentor 1.4.3