Just checked XML spec and there's nothing about escaping $c(10) or $c(13).
The only symbols which must be escaped are:
- " "
- & &
- ‘ '
- ' '
- < <
- > >
You can check $zcvt - it produces the same output:
zw $zcvt("< > &" _$c(10)_$c(13)_ "TEST", "O", "XML")If you need byte for byte compatibility you'll need a custom datatype with a redefined LogicalToXSD method. Something like:
Class test.XMLString Extends %String
{
ClassMethod LogicalToXSD(%val As %String) As %String [ CodeMode = objectgenerator, ServerOnly = 1 ]
{
quit:%mode'="propertymethod" $$$OK
Do %code.WriteLine($c(9) _ "set %val = $zcvt(%val,""O"",""XML"")")
For replace=$lb("$c(10)","""
"""),$lb("$c(13)","""
""") {
Set from = $lg(replace, 1)
Set to = $lg(replace, 2)
Do %code.WriteLine($c(9) _ "set %val = $replace(%val," _ from _ ", " _ to _")")
}
Do %code.WriteLine($c(9) _ "quit %val")
Quit $$$OK
}
}- Log in to post comments