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

XML export from AX3

(0) ShareShare
ReportReport
Posted on by 20

Hello,

I am importing a project from AX9 to AX3 and now I have to modify a class that I created for XML exporting.

    xmlRecordList             = xmlDoc.createElement2(#RecordList, #journal);
    xmlRecordList.setAttribute(#gpais, #common);
    xmlRecordList.setAttribute(#kls, #gpaisKls);

    xmlSubject = xmlDoc.createElement2(#Subject, #journal);
    xmlSubject.setAttribute(#Code, CompanyInfo::Find().goGPAISSubjectId);
    xmlRecordList.appendChild(xmlSubject);

    xmlRecords = xmlDoc.createElement2(#Records, #journal);

This is a part of the code from AX9 that I wrote, but there is no "createElement2()" method in AX3 how can I get a similar result?

my XML has to look like this:

1346.com.PNG

Any idea how to get that last attribute in without it duplicating in other tags?

*This post is locked for comments

I have the same question (0)
  • Martin Dráb Profile Picture
    237,878 Most Valuable Professional on at

    How did you export the data from AX 2009? Can't you simply put everything to the default namespace? You wouldn't have this problem at all.

  • Raimund Profile Picture
    20 on at

    In AX9 I used createElement2 method as I have already mentioned, but in AX3 there is no such method. What do you mean by "put everything to the default namespace"?

  • Martin Dráb Profile Picture
    237,878 Most Valuable Professional on at

    If it means that you export data from AX 2009 by your own code just to be able to import it to Axapta 3.0, why do complicate everything for yourself by settings namespaces like xmlns:kls="urn:x..."? (If you're not aware of it, xmlns stands for XML NameSpace.) If you omit that, you'll still have all the data and your code on both sides will be simpler.

    If you have a reason for it, you forgot to mention it.

  • Raimund Profile Picture
    20 on at

    sorry I might have explained it badly I made a project in AX9 for clients and they will need to export XML files and then send those files to a webservice. Some clients that also are in need of that function have AX3 installed so I had to import my project (with this class), but in AX3 the class xmlDocument does not have the method createElement2. Which is why I am struggling in remaking my code in AX3

  • Martin Dráb Profile Picture
    237,878 Most Valuable Professional on at

    Aha, I've got it now. You have working code in AX 2009 and you tried to use the same code in Axapta 3.0, but it doesn't work because XmlDocument class there doesn't have createElement2() method. Now you're looking for another way how to create an element with a specific namespace URI.

    Unfortunately I haven't seen Axapta 3.0 for so many years that I don't remember methods available in its version of XmlDocument class. I assume that setting namespace is possible, because it's a very important thing, but I can't provide any details.

    You could also use .NET XmlDocument class directly, but it's not very easy in Axapta 3.0. .NET Interop was introduced only in Dynamics AX 4.0; it would have been easier if they upgraded AX in past twelve years.

    Another (ugly) option would be composing XML as text by yourself.

  • Raimund Profile Picture
    20 on at

    Ok got it, well i will try to search for it again, maybe i will find something simillar and update this post.

    Thank you for the advice!

  • Suggested answer
    Rustem Galiamov Profile Picture
    8,072 on at

    Hi!

    In AX 3.0 XmlDocument has a createElement() method with only one parameter. Maybe you need try to create you own class extended from XmlDocument class in AX 3.0 with all necessary methods from AX 2009?  

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

#1
Priya_K Profile Picture

Priya_K 4

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#3
Ali Zaidi Profile Picture

Ali Zaidi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans