web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Add NameSpace in XML in

(0) ShareShare
ReportReport
Posted on by 155

Hello Anyone,

I want to add multiple name space in XML Node through code in D365 F&O

Please see the below image

 Node.png

How we can achieve this ? Any suggestion.

  • Sergei Minozhenko Profile Picture
    23,099 on at

    Hi Mayur,

    Could you, please, clarify you create XML file?

  • Mayur Saini Profile Picture
    155 on at

    Thanks for reply.

    See the generated XML

    1663.Node.png

  • Mayur Saini Profile Picture
    155 on at

    2502.Code.png

    See sample code to generate code 

  • WillWU Profile Picture
    22,363 on at

    Hi Mayur,

    Please try this:

    docNode.setAttribute("Cstmr...","http:// ... ... file..xsd");

    Hope this helps.

  • Mayur Saini Profile Picture
    155 on at

    Thnks for reply but in XMLNode setAttribute method is not available

    Thanks everyone but in other way i have achieve this functionality.

  • WillWU Profile Picture
    22,363 on at

    Hi friend,

    Sorry for that I didn't give the declaration of variable. 

    You can use XmlElement class and you will be able to use it.

    Hope this helps.

  • Suggested answer
    Martin Dráb Profile Picture
    241,509 Most Valuable Professional on at

    You also must provide the default namespace - use createElement2() for that. Here is a complete solution:

    XmlElement docNode = doc.createElement2('Document', 'urn:iso:blahblah');
    docNode.SetAttribute("xmlns:xsl", "http://www.w3.org/2001/XMLSchema-instance");
    doc.appendChild(docNode);

  • Verified answer
    Mayur Saini Profile Picture
    155 on at

    Thnks Martin i don't know your code will be work or not ? but i am using below code.

           // generate header details

           XmlElement docElement = doc.createElement('Document');

           docElement.setAttribute('xmlns:xsi','www.w3.org/.../XMLSchema-instance');

           docElement.setAttribute('xmlns','urn:iso:std:iso:20022:tech:xsd:pain.001.001.03');

           doc.appendChild(docElement );

  • Martin Dráb Profile Picture
    241,509 Most Valuable Professional on at

    Yes, it'll work. Why don't you simply try it?

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

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

#1
Martin Dráb Profile Picture

Martin Dráb 536 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 320 Super User 2026 Season 2

#3
CU-1234529-002 Profile Picture

CU-1234529-002 210

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans