/

RSS Post Importer - Advanced - Extracting Specific XML Tags


Extracting Specific XML Tags

Back to User Guides

When setting up feeds, 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

  1. Step 1) Identifying the Tag
  2. Step 2) Choosing the Namespace
  3. 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, where you would like to extract the contents Itunes Summary <itunes:summary> and Date of Publication <pubDate>. 

Restriction

It's not possible to:

  1. Get tags inside another tag.
  2. Get tag content if it is a complex of few 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

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


Get more information about the RSS Post Importer Plugin

Find other WordPress products at the CreativeMinds WordPress Store

Let us know how we can Improve this Product Documentation Page

Open a Support Ticket from our customer support center