<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[XML Tools Plugin - Prettify &amp; Check xml inside CDATA?]]></title><description><![CDATA[<p dir="auto">I have a format of XML file that essentially contains XML data inside CDATA tags.</p>
<p dir="auto">Example:</p>
<p dir="auto">&lt;Configuration Name=“MacroName”&gt;<br />
&lt;Value&gt;&lt;![CDATA[&lt;Macro&gt;<br />
&lt;TagOne Name=“Uno”/&gt;<br />
&lt;/Macro&gt;&rsqb;&rsqb;&gt;&lt;/Value&gt;</p>
<p dir="auto">(but tens of thousands of lines)</p>
<p dir="auto">Are there any settings I could set in the XML Tools plugin that would Check (and preferably prettify) the XML data inside the CDATA[] tags as well as the actual wrapping XML?</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/16087/xml-tools-plugin-prettify-check-xml-inside-cdata</link><generator>RSS for Node</generator><lastBuildDate>Fri, 17 Apr 2026 02:15:19 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/16087.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 25 Jul 2018 18:58:10 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to XML Tools Plugin - Prettify &amp; Check xml inside CDATA? on Wed, 25 Jul 2018 22:00:53 GMT]]></title><description><![CDATA[<p dir="auto">As a follow on, I found a couple minutes to play a bit with the pretty-print and validate: the pretty-print does seem to work on a selection; the validate seemed to use the whole document, even when I just had the small segment selected.  Though since I’m not good at XML, I could be wrong in my interpretation.</p>
<p dir="auto">However, while the XML Tools pretty-print does work with individual selections, I had forgotten you said there may be thousands, which means it won’t be very efficient.  I think the three-step search+replace/xml tools/search+replace is probably the best in-Notepad++ option.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/33732</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/33732</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Wed, 25 Jul 2018 22:00:53 GMT</pubDate></item><item><title><![CDATA[Reply to XML Tools Plugin - Prettify &amp; Check xml inside CDATA? on Wed, 25 Jul 2018 19:52:26 GMT]]></title><description><![CDATA[<p dir="auto">My guess is that the answer is no, though I’m not an XML Tools Plugin guru (in fact, I rarely use it).</p>
<p dir="auto">However, as an outsider’s suggestion, I would try the following three step process</p>
<ol>
<li>Search and Replace (non-regular-expression) <code>&lt;![CDATA[</code> to <code>∠∠</code>, and <code>&rsqb;&rsqb;&gt;</code> to <code>⟂⟂</code> (where ∠∠ and ⟂⟂ were chosen as character sequences not likely in your document; if they are, pick some different delimiter</li>
<li>Since the CDATA markers are out of the way, XML Tools should validate and/or prettify the internal contents along with the structured</li>
<li>Search and Replace  <code>∠∠</code> back to <code>&lt;![CDATA[</code>, etc.</li>
</ol>
<p dir="auto">You might be able to get away with <code>&lt;was:CDATA&gt;</code> and <code>&lt;/was:CDATA&gt;</code>, though I don’t know whether that would validate properly; I am <em>not</em> an XML expert.</p>
<p dir="auto">Failing that, I would use a real XML tool to extract the CDATA; then run that extracted text through the prettify/validate; then repopulate the CDATA contents with the results. (less automatic, less fully contained in Notepad++/XML-Tools, but possibly easier to implement, if my three-step doesn’t work).</p>
<p dir="auto">Personally, if the search/replace wasn’t sufficient, I would do that whole process in a single Perl script, using one of the XML modules in CPAN, like <a href="http://search.cpan.org/perldoc?XML%3A%3ALibXML" rel="nofollow ugc">XML::LibXML</a> or <a href="http://search.cpan.org/perldoc?XML%3A%3ATwig" rel="nofollow ugc">XML::Twig</a> for the CDATA extraction and insertion, and piping through some external executable to get the prettification.  Others here could probably recommend equivalent Python modules/packages/whatever-they’re-called.  One benefit of a Python solution would be that you might be able to do it fully within the PythonScript plugin for Notepad++, so keeping it more contained.</p>
<p dir="auto">Ooh, I just thought of something: Can XML Tools be told to just prettify or validate a particular selection, rather than the whole document?  If so,</p>
<ol>
<li>search for something like this regular-expression: <code>(?s)&lt;!\[CDATA\[\K.*?(?=\]\]&gt;)</code> (that appears to highlight the contents of an individual CDATA section</li>
<li>apply the XML Tools prettify or validate on just that selection</li>
<li>find-next and repeat on the next selection, <em>ad infinitum</em></li>
</ol>
<p dir="auto">-----<br />
<strong>update</strong>: by “regular expression”, I mean enable the <code>☑ Regular Expression</code> option in the find or replace dialog window; by “non-regular-expression”, I mean enable the <code>☑ Normal</code> option.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/33731</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/33731</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Wed, 25 Jul 2018 19:52:26 GMT</pubDate></item><item><title><![CDATA[Reply to XML Tools Plugin - Prettify &amp; Check xml inside CDATA? on Wed, 25 Jul 2018 19:27:37 GMT]]></title><description><![CDATA[<p dir="auto">Not that it needs to be more complicated, but not all the text in the CDATA[] fields is XML. Some is just plain text and variables.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/33730</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/33730</guid><dc:creator><![CDATA[Jorge VT]]></dc:creator><pubDate>Wed, 25 Jul 2018 19:27:37 GMT</pubDate></item></channel></rss>