RSS Post Importer - Advanced - Extracting Specific XML Tags
Extracting Specific XML Tags
When setting up feeds with the RSS Post Importer, the Add New XML Tag button can be used to capture specific tags into new shortcodes. This guide will explain this advanced feature in detail.
Table of Contents
- Step 1) Identifying the Tag
- Step 2) Choosing the Namespace
- Step 3) Add the Shortcode to the Post Template
Step 1) Identifying the Tag
a) Find the Tag Where The Desired Content is Located
Let's consider the following example:
You would like to extract the contents Itunes Summary <itunes:summary> and Date of Publication <pubDate>.
Restriction
It's not possible to:
- Get tags inside another tag.
- Get tag content if it is a complex of tags (has tags inside).
Note that <itunes:summary> has a prefix before the ":" ("itunes") and <pubDate> doesn't have any prefix. This takes us to the next step.
Step 2) Choosing The Namespace
Now it's time to add the tags, and for that, we need to know the namespace of each. Namespace refers to the way the elements are written down and organized.
The end result should be something like this:
a) Finding out the Namespace and Tag Name
There are simple rules, depending on the existence of a prefix:
- Tag has prefix
- Namespace will be the prefix. Example: <itunes:summary> → itunes is the prefix, so it's the Namespace.
- Tag Name will be the remaining of the word. Example: <itunes:summary> → "summary" is the Tag Name.
- Tag doesn't have prefix
- Namespace will be RSS 2.0 - Blank. Example: <pubDate> → RSS 2.0 is the Namespace.
- Tag Name will be the whole word. Example: <pubDate> → Tag Name is the whole tag, "pubDate".
List of Namespaces
- RSS 2.0 - Blank. RSS 2.0 doesn't have a namespace. If there the tag has no prefix, choose this.
- XML Learn more
- ATOM 1.0 Learn more
- ATOM 0.3 Learn more
- RDF Learn more
- RSS 0.90 Learn more
- RSS 1.0 Learn more
- RSS 1.0 MODULES CONTENT Learn more
- DC 1.0 Learn more
- DC 1.1 Learn more
- W3C BASIC GEO Learn more
- GEORSS Learn more
- MEDIARSS Learn more
- ITUNES Learn more
- XHTML Learn more
- BASE GOOGLE 1.0 Learn more
By adding the guid tag to the Add New XML Tag option, the plugin generates a shortcode for each. In this case, [rss_feed_item_pubdate]
and [rss_feed_item_summary]
. This takes us to the next step.
Step 3) Add the Shortcode to the Post Template
You should then add this shortcode to the post template (learn more: RSS Post Importer - Set Up - 4) How the Posts Are Displayed (Post Template)).
In this specific case, the shortcodes would produce this in the Front-End:
[rss_feed_item_summary]
Former PGA Tour pro and Jungle Legend Steve Elkington joins The Jim Rome Podcast for Episode 76. Elk Previos the Masters, tells some Colin Montgomery stories, talks Tigere's win in 1997 and his chances this weekend, Phil Mickelson, and the direction Jordan Spieth and Justin Thomas are trending.
[rss_feed_item_pubdate]
Tue, 09 Apr 2019 20:37:25 + 0000
More information about the RSS Post Importer plugin for WordPress Other WordPress products can be found at CreativeMinds WordPress Store |
|
Let us know how we can Improve this Product Documentation Page To open a Support Ticket visit our support center |