Question about 'CDATA' inside JavaScript type action in xml

  • Hi, Klaus!

    Just yesterday I worked with some simple JavaScript action in Krpano and noted accidentally that it worked also without the 'CDATA' tags inside it. So I wondered, what is the recommended usage of these tags for JavaScript actions - use them always anyway or just for those actions which contain reserved XML characters inside ?

  • Hi,

    right, the CDATA is there is avoid that the xml parser will check/parse the content.

    Otherwise you would get xml-parsing-errors when using chars like '<' or '&' in the code.

    E.g. Javascript code like:

    Code
    if(a < b)

    or

    Code
    if(a && b)

    would trigger a xml-parser error without CDATA tag.

    When non XML-problematic characters are used in the code, it would work also without CDATA, but it should be a good practice adding them anyway.

    Best regards,
    Klaus

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!