title: XML CDATA error: The element type <X> must be terminated by the matching end-tag </X>
body: <p>I am receiving the following data in an XML feed:</p>
  
  <pre><code>&lt;imagetag&gt;&lt;![CDATA[
  http://images.dealer.com/0098/65654e9beaae8aca2eeb7778e723e733x.jpg]
  ]&gt;&lt;/imagetag&gt;
  </code></pre>
  
  <p>I have two problems with it:</p>
  
  <ol>
  <li>When I try to validate the XML <a href="http://www.xmlvalidation.com/index.php?id=1&amp;L=0" rel="nofollow noreferrer">here</a> I get an error: <code>The element type "imagetag" must be terminated by the matching end-tag "&lt;/imagetag&gt;".</code></li>
  <li>I can't figure out a (Javascript) regular expression to extract the url. The closest I have come is: <code>([\s\S]*)&lt;imagetag&gt;&lt;!\[CDATA\[([\s\S]*)\]\]&gt;&lt;\/imagetag&gt;([\s\S]*)</code>. This works perfectly if there is no line-break after <code>.jpg]</code>, but there is!</li>
  </ol>
  
  <p>I guess these two issues are related but I'm not sure of the cause. Any help appreciated!</p>