I am trying to generate a XML text using Views.
How can I avoid all "<" and ">" characters to be filtered out?
I have already unset "Disable the wrapping DIV around the View" and removed the filter in the Output Editor, but didn't worked.
Also the solutions I have found in this Support (ex. https://toolset.com/forums/topic/need-to-strip-views-formatting/) won't help.
Any idea?
Thanks
Hello,
First, Toolset Views does not filtered out "<" and ">" characters.
I have tried it in a fresh WP installation + the latest version, by these steps:
1) Create a post view, in section "Loop Editor", copy/paste the XML Schema codes from doc:
hidden link
2) Put above post view into a page, and test it in front-end, I can see those XML codes work fine, see my screenshot: xml.JPG
Is there anything missing? please provide detail steps to reproduce the same problem
Second, you don't need the custom codes, you can edit the post view, in section "Loop Editor", enable option "Disable the wrapping DIV around the View", it can remove the wrapper DIV tag without custom codes.
Sorry for the misunderstanding.
What I am trying to achieve is that the XML should be output as normal text you can see in a page, not as code in console.
In my case it should loop something like this:
<?xml version="1.0" encoding="utf-8"?>
<ads>
<ad>
<id><![CDATA[[wpv-post-id]]]></id>
<title><![CDATA[[wpv-post-title output="sanitize"]]]></title>
</ad>
</ads>
Additionally, it should resolve the Types shortcodes properly.
Within WordPress the [] will take as a shortcode, it conducts the problem you mentioned above, see WP document:
https://codex.wordpress.org/Shortcode_API
And in your case, you don't need the <![CDATA[ ...]]>, you can display Types shortcode directly, for example:
<?xml version="1.0" encoding="utf-8"?>
<ads>
<ad>
<id>[wpv-post-id]</id>
<title>[wpv-post-title output="sanitize"]</title>
</ad>
</ads>
My problem is that I need the [CDATA[....]], as this view should be used to create a XML feed for an external service and they have a strict syntax protocol for the feed.
That's also the reason why I need a pure, raw text output.
Please check the document I mentioned above:
https://codex.wordpress.org/Shortcode_API
Within WordPress, the [] will take as a shortcode, it conducts the problem you mentioned above
You can simply test below codes in a fresh new post:
[CDATA[[wpv-post-id]]]
It won't resolve the shortcode [wpv-post-id]
So there isn't such kind of built-in feature within Toolset or WordPress, you will need to consider custom codes, for example create custom shortcodes to output what you want, see the document I mentioned above.