Ampersand (&) in xml-file

helmhelm Posts: 46Member
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

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

Thanks in advance.


  • SteveOSteveO Posts: 164Member
    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 Posts: 46Member
    In Navision CONFIRM is showing "Some company & Bros". But in the XML-file it has changed to the invalid character "&".
  • MalajloMalajlo Posts: 294Member
    Use diffrent variable name. Perhaps NAV retrievs system var COMPANYNAME not CompanyName (specialy if it is not in same function).
  • helmhelm Posts: 46Member
    The variable is not called companyname and I still get the same result
  • pduckpduck Posts: 147Member
    helm wrote:
    The variable is not called companyname and I still get the same result

    With which program do you view the File?
  • helmhelm Posts: 46Member
    I've used XML Notepad 2007 and Internet Explorer
  • pduckpduck Posts: 147Member
    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 Posts: 46Member
    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 Posts: 147Member
    Which program? Maybe you can post a part of the xml including the header and the line with the Company Name here?
  • helmhelm Posts: 46Member
    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 Posts: 85Member
    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?


Sign In or Register to comment.