XML, RSS: read & create
What is XML?
XML stands for “Extensible Markup Language,” a text-based markup language. They are designed to structure machine-readable data in a Text-File.
JCI and XML: No Problem!
As the Plugin is called “JSON Content Importer” you might think it can handle only the JSON-Format. But JCI can do more!
It can read XML, converts it into JSON, and work with it.
Read XML and convert it to JSON
Just add inputtype=XML
to the Shortcode:
[jsoncontentimporterpro nameofthetemplate=... inputtype=XML]
Create XML out of JSON
Create a JCI-Template and put XML text like the following into the twig-Template Text:
<?xml version="1.0" encoding="windows-1252"?> <rss version="2.0"> <channel> <title>titleexample: {{title}}</title> <description>descriptionexample</description> <link>http://...link</link> <copyright>Copyright 20...</copyright> <docs>http://....docs</docs> <language>en-us</language> <lastBuildDate>Tue, 21 Oct 2019 03:19:24 -0800</lastBuildDate> <managingEditor>info@.....com</managingEditor> <pubDate>Tue, 21 Oct 2019 12:18:22 -0300</pubDate> <webMaster>webmaster@....com</webMaster> <generator>JCI</generator> <image> <url>http://www.....gif</url> <title>titleimage</title> <link>http://www....imagelink.htm</link> <description>descriptionimage</description> <width>480</width> <height>480</height> </image> <item> <title>titleitem</title> <description>descriptionitem</description> <link>http://www.linkitem</link> <comments>commentsitems</comments> <pubDate>Tue, 21 Oct 2019 07:38:46 -0800</pubDate> </item> </channel> </rss>
Also, add a URL and, if needed, some more info to get the JSON. When the Shortcode is used, the XML text is evaluated by twig, and code like {{title}} (see XML) is replaced by the JSON data.
If the previous gave you XML, you can edit the template and insert more twig code to insert JSON data. In the end, you get an XML feed out of JSON.
RSS: Special XML
The above XML is a particular XML style called RSS. This is used at Newsreaders or Sliders.
Notice: RSS is sensitive to special chars and chars used for RSS.
Therefore, you must add some “wrapping code” with “CDATA” to tell RSS that data is enclosed here, not XML syntax.
<![CDATA[ text.... ]]>
By using “?show=oc” you can remove the WordPress-Template to get pure XML. Read more on that here.