TechyMedia

A .NET Technology blog | .NET,C# Progamming,C# tutorials,WPF WCF|Software Engineer

NAVIGATION - SEARCH

How To Store Java Scripts In XML

CDATA can be used to store text data in XML file so that it should not be parsed by any XML parser. Any data stored under CDATA are recognized as non markup.For more details on CDATA read the article CDATA(Character Data In XML).

 CDATA can be used to store text data in XML file so that it should not be parsed by any XML parser. Any data stored under  CDATA are recognized  as non markup.For more details on CDATA read the article CDATA(Character Data) in XML.

Here below a sample script stored in XML file with CDATA.Ignore the correctness of the script function.

<?xmlversion="1.0"encoding="utf-8" ?>

<script>

   <![CDATA[

      function FindHigher(var1,var2,var3)

      {

        if (var1 > var2 && var1 > var2) then

        {

          return var1;

        }

        if(var2 > var1 && var2 > var3) then

        {

          return var2;

        }

        if(var3 > var1 && var3 > var2) then

        {

         return var3;

        }

        else

        {

          return 0;

        }

  ]]>

</script>

Pingbacks and trackbacks (1)+

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading