Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested answer

store string in a variable

(2) ShareShare
ReportReport
Posted on by 1,549
Hi,

How to save this xml inside a string:
I'm getting errors because of the quotations
 
        str xml = "<?xml version="1.0" encoding="UTF-8"?>
            <note>
            <to>Tove</to>
            <from>Jani</from>
            <heading>Reminder</heading>
            <body>Don't do it!</body>
            </note>";

Categories:
  • Suggested answer
    Martin Dráb Profile Picture
    233,724 Most Valuable Professional on at
    store string in a variable
    Because the string contains multiple double quotes and only a single one, a better approach will be wrapping the string in single quotes and escape only the single quote / apostrophe: '<?xml version="1.0" ... Don\'t ...'.
  • André Arnaud de Calavon Profile Picture
    294,931 Super User 2025 Season 1 on at
    store string in a variable
    Hi ..,
     
    Can you tell us what exactly you are doing in Dynamics 365 and what errors you get?
  • Suggested answer
    Waed Ayyad Profile Picture
    8,450 Super User 2025 Season 1 on at
    store string in a variable
    Hi @..,
     
    You should use Escape character before "
     as below
     
     str myText = "He said, \"Hello\" and left.";
     
    String value:  He said, "Hello" and left.
     

     

    Thanks,

    Waed Ayyad

    If this helped, please mark it as "Verified" for others facing the same issue

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 501 Most Valuable Professional

#2
Saalim Ansari Profile Picture

Saalim Ansari 315

#3
Abhilash Warrier Profile Picture

Abhilash Warrier 310

Overall leaderboard

Product updates

Dynamics 365 release plans