Sxml.Execute() Example (allowSyntaxExceptionCatching)
Syntax Exceptions are normally uncatchable, except when rendering sxml indirectly using the embed macro.
Setting the allowSyntaxExceptionCatching parameter to true allows you to execute code that potentially has syntax exceptions and catch the exception, to prevent your page to fail when you execute dynamically assembled code.
Smartsite SXML | Copy Code |
---|---|
<se:hidden> <se:text save="a"><![CDATA[ <se:test1234567> Bla </se:test1234567> ]]></se:text> </se:hidden>{sxml.execute(sxml.decode($a), true, error=sys.lastexception.message())} |
Example Result | Copy Code |
---|---|
The sxml could not be executed: Module not found: 'test1234567' |