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

Notifications

Announcements

No record found.

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.

I have the same question (0)
  • Sergei Minozhenko Profile Picture
    23,093 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,361 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,361 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
    237,801 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
    237,801 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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
Martin Dráb Profile Picture

Martin Dráb 664 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 522 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 303 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans