Skip to content
This repository has been archived by the owner on Jan 14, 2022. It is now read-only.

CDATA #9

Closed
cecilemuller opened this issue Mar 11, 2015 · 1 comment
Closed

CDATA #9

cecilemuller opened this issue Mar 11, 2015 · 1 comment
Labels

Comments

@cecilemuller
Copy link
Member

One may wonder:

How to convert CDATA blocks of text to JSON?

@cecilemuller
Copy link
Member Author

CDATA

CDATA is a XML-only concept that doesn't exist in VRML or JSON, so you can use simple String values for SFString values that the XML encoding would express as CDATA.

JSON:

{
    "$": "Script",
    "url": [
        "javascript: function initialize(){trace('Hello World');}"
    ]
}

VRML:

Script {
    url [
        "javascript: function initialize(){trace('Hello World');}"
    ]
}

X3D / XML Encoding:

<Script>
    <![CDATA[ javascript: function initialize(){trace('Hello World');}]]>
</Script>

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant