Ampersand (&) in xml-file

helmhelm Member Posts: 46
I have made an XML-file using the write-command because I need to format it in a way not possible with an XML-port. Some Company names have ampersands (&) in them. Since that sign it not allowed in an XML-file I replace them with '&'. But when the file is created the '&' is back. I've checked that the replacement went fine with
IF CONFIRM(CompanyName) THEN;

It seems as Navision interpret '&' as '&'. Is there any way to force the sign to '&' ?

Thanks in advance.

Comments

  • SteveOSteveO Member Posts: 164
    Is your CompanyName variable local or global?

    If it is global then the CONFIRM is actually showing the original Company Name and not your string with the ampersand being replaced.
    Try renaming your variable to CompName or something similar.
    This isn't a signature, I type this at the bottom of every message
  • helmhelm Member Posts: 46
    In Navision CONFIRM is showing "Some company & Bros". But in the XML-file it has changed to the invalid character "&".
  • MalajloMalajlo Member Posts: 294
    Use diffrent variable name. Perhaps NAV retrievs system var COMPANYNAME not CompanyName (specialy if it is not in same function).
  • helmhelm Member Posts: 46
    The variable is not called companyname and I still get the same result
  • pduckpduck Member Posts: 147
    helm wrote:
    The variable is not called companyname and I still get the same result

    With which program do you view the File?
  • helmhelm Member Posts: 46
    I've used XML Notepad 2007 and Internet Explorer
  • pduckpduck Member Posts: 147
    Try to open it with a simple Texteditor like the one coming with Windows or PsPad. You will see that there is the "&"-String. Especially Microsoft Products show the unmasked Characters when open a XML File. In the past we had a lot of support trouble because of this.

    I use XML Spy, PSPad and JEdit for deep editing XML Files.
  • helmhelm Member Posts: 46
    Thank you very much for your help pduck. You are correct that the string shows & in notepad. :D But why does the other programs complain about the illigal character then? :|
  • pduckpduck Member Posts: 147
    Which program? Maybe you can post a part of the xml including the header and the line with the Company Name here?
  • helmhelm Member Posts: 46
    Just noticed that the contact name was the same as the company name, and that I hadn't changed the character there. #-o I just assumed that it was the company name that had the invalid character, because I would never register the same name as both contact and company. Sorry about not noticing this previously. :oops:
  • Maria-SMaria-S Member Posts: 90
    haha, this thread is un-understandable now:
    helm wrote: »
    It seems as Navision interpret '&' as '&'. Is there any way to force the sign to '&' ?

    My problem is XMLPort produces four-letter sign instead of one-letter sign. How can I produce one-letter amplersand instead?

    mf0j6lfsasey.png

Sign In or Register to comment.