I have the following XML:
<?xml version="1.0" encoding="UTF-8"?>
<fld>Smith & Company</fld>
This fails when I use LoadXML into an XMLDocument. But if I remove that one ampersand in third fld, it works fine. Are there any other characters that are not valid in values?
Like HTML, XML codes certain characters as HTML entities.
“&” should be entered as
Where did the original XML come from that it was improperly encoded?
Thank you everyone! It’s coming from a FileMaker database as tab delimited data that I “converted” to xml. It looks like I need to deal with the following based on Michel’s wikipedia link.
I’m really surprised that it doesn’t just respect anything within the tags.
Can I just wrap everything within the tags with CDATA?
Can you export the FileMaker data as XML to begin with? (They implement their own format.) Otherwise, how are you doing the converting?
I’m trying to see if there is a better way for you to be doing whatever you’re doing.
Since you know it’s not “real” xml, a few ReplaceAll commands before you LoadXML should do you.
Edit: Except for the < and > symbols, of course. Nvm, this may not be the best solution.
I wish. I’m building an SQL statement in Xojo and sending that over to FileMaker which then returns the data, but it’s basically tab delimited text.
I decided to embrace the format right than fight it by using NthField. I just got everything working and it’s perfect. I thought it’d be better to use XMLDocument, but that required massaging the data. Using NthField resulted in no massaging.
Thanks again for everyone’s help!
Use Split into an array rather than NthField, unless you’re a fan of slow code.