ELEMENT:  <![CDATA[...]]>

Strictly speaking, the <![CDATA[...]]> tag is not part of the WSH XML element. However, it is very useful to tell the XML parser not to parse the contents wrapped inside the <![CDATA[...]]> section. This will prevent the XML parser from failing when the contents contain some XML-reserved characters, such as ampersand (&).

The following sample code cannot be parsed correctly by the XML parser.

<?XML version="1.0" ?>
<!-- Filename: demo.wsf-->
<package>
  <job>
    <script language="VBScript">
      WScript.Echo "Hello " & "World!"
    </script>
  </job>
</package>

The following sample code illustrates how the <![CDATA[...]]> tag can be used to fixed the erroneous code shown above.

<?XML version="1.0" ?>
<!-- Filename: demo.wsf-->
<package>
  <job>
    <script language="VBScript">
    <![CDATA[
      WScript.Echo "Hello " & "World!"
    ]]>
    </script>
  </job>
</package>

Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information