I’ve got a requirement to call an external Stored Proc and pass through a large string of XML as the only parameter. I’ve made sure to encode the XML characters needed safely, – https://keylimetie.com/blog/2008/9/25/how-to-safely-escape-invalid-xml-characters/
However, I still get “XML Parsing: Line 1, character X, illegal XML character” errors returning, for strings containing characters like “£” and “-”. As far as I know I shouldn’t need to encode these, but I haven’t worked with calling SQL from Mendix before, so it’s all a bit new to me.
Anyone had similar issues before? Any ideas on workarounds?
Your post is a bit confusing. You are either passing XML, or you are just passing a String. If you need to pass XML, you should not need to worry about escaping as long as the String you provide is proper XML.
Escaping only applies when constructing the XML string. this is not normally something you need to worry about, since you normally use some type of library to handle constructing the XML for you.
The solution might also be found in something having to do with the encoding of the database connection. It might be interesting to try what happens when using Squirrel or another proper SQL-client, since it allows you to fiddle around with connection and encoding settings.