News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

how do you remove code that includes a <![CDATA[ tag?

Started by Deprecated, March 08, 2016, 08:24:52 PM

Previous topic - Next topic

Deprecated

The modification.xml file uses <![CDATA[ and ]]> to escape characters that would mess up XML.

But... The code I am trying to delete includes a JavaScript with <![CDATA[ and ]]> tags. I can see in writing my modification file that the two are clashing and interfering.

I can just tell that this is NOT going to work!

What do I do now?

dougiefresh


<script type="text/javascript"><!-- // --><![CDATA[<]]><![CDATA[![CDATA[
// ]]]]><![CDATA[></script>';

should work in the XML file.....

Deprecated

Thanks! I don't quite understand it but I think I can figure out how to give it a try and see if it works.

Is that part of the search or what? It's the strangest thing I've seen in a long time!

Too bad we can't just have a search replace function where you define "starts with this stuff" and "ends with this stuff" and replace everything between. (Or in my case just delete it.)

You have inspired me to give it another whack instead of just giving up and leaving the script in. Thank you!

dougiefresh

I'm sorry.  I should have been more specific.....  It is for both the search and add tags inside an operation.....

For the opening javascript bracket, the following code:
Code (Search) Select
<script type="text/javascript"><!-- // --><![CDATA[
would be replaced by this:
Code (Replace) Select
<script type="text/javascript"><!-- // --><![CDATA[<]]><![CDATA[![CDATA[
AND for the closing bracket, the following code:
// ]]></script>
would be replaced by this:
Code (Replace) Select
// ]]]]><![CDATA[></script>
in order to properly search for or add/replace javascript bracketed code.  I personally find it a little easier to search for the javascript code itself than to try to search for the bracketed stufff....


Deprecated

Actually I am REMOVING the code and the CDATA already in the file. Would the same process work in reverse?

In other words:

search:<script type="text/javascript"><!-- // --><![CDATA[<]]><![CDATA[![CDATA[
code
code
code
// ]]]]><![CDATA[></script>


replace:<!-- all gone! -->


Advertisement: