Search This Blog

Thursday, 26 March 2015

Handling a full stop in a XML element name


The “.” (full stop) character is valid in an XML name, this means there can be cases were you need to escape a full stop in a SOM expression.

This is the default format when using SQL Server and the FOR XML AUTO option and the table has
a schema, you will end up with XML like;

<ClientMgmt>
<ClientMgmt.ClientDetails name="..." />
<ClientMgmt.ClientDetails name="..." />


In a SOM Expression the full stop needs to be escaped with a “\” (backslash), when we put this in JavaScript code we again need to escape the backslash, so end up with three backslash characters.
$data.resolveNodes('ClientMgmt.ClientMgmt\\\.ClientDetails[*]')
Interestingly when trying the same in the Acrobat JavaScript debugger you need to use four backslash characters.

No comments:

Post a Comment