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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

XML tags in AX, how to remove name space from an XML Tag

(0) ShareShare
ReportReport
Posted on by 95

Hi All,

I am creating an XML in AX 2012, my XML format achieved from code is

Comparision-of-Output.jpg

My Code is :

XmlDocument xmlDoc;
XmlNode nodeRoot;
XmlElement catNode, dataAreaNode, processNode, processSubNode;
XmlElement applicationArea;
XmlElement senderInfo, sender;
XmlWriter xmlWriter;
;

xmlDoc = XMLDocument::newBlank('UTF-8');
nodeRoot = xmlDoc.documentElement();

//Create catNode Node
catNode = xmlDoc.appendChild(xmlDoc.createElement2('cat', 'cat01')); //'catalog','cat01'));

catNode.setAttribute('xmlns:prod','http://datypic.com/prod');
catNode.setAttribute('xmlns:cat01','http://datypic.com/cat');

//Create area Node
applicationArea = catNode.appendChild(xmlDoc.createElement3('prod','product','cat01'));

//Create Sender Node
senderInfo = applicationArea.appendChild(xmlDoc.createElement3('prod', 'number', 'cat01'));
senderInfo.text('563');

//Create Creation date time Node
senderInfo = applicationArea.appendChild(xmlDoc.createElement3('prod','name', 'cat01'));
senderInfo.text('Floppy Sun Hat');

xmlWriter = XMLWriter::newFile(@"D:\New folder\cars18.xml");
xmlDoc.writeTo(xmlWriter);
info("Bnvf");

My required/Target XML format is

 Example--XML-Image.JPG

I need your suggestions for achieving this format, where should i change my code.

Regards,

rakesh

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at

    Hi Rakesh

    I have exactly the same problem.

    Did you find a solution?

    Regards

    William

  • Haithem Fezzani Profile Picture
    on at

    Hi all,

    There is a solution to remove xlmns:prod="cat01" from this tag:
    <prod:number xmlns:prod="cat01" >567</prod:number> and keeping catalog’s tag intact.

    • Just maintain the same value of nameSpace similar in all created tags.

    For more details, please follow the link bellow:

    https://youtu.be/w7ZMnqh4UCU

     

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

News and Announcements

Season of Giving Solutions is Here!

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 > 🔒一 Microsoft Dynamics AX (Archived)

#1
TAHER Mehdi Profile Picture

TAHER Mehdi 3

#2
Martin Dráb Profile Picture

Martin Dráb 2 Most Valuable Professional

#2
Volodya Profile Picture

Volodya 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans