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)

Writing xml in special form

(0) ShareShare
ReportReport
Posted on by

Hi all I have to write some code to create an xml. I did that but it looks completely different. How do I have to write the code to get the following result:

xml.JPG

*This post is locked for comments

I have the same question (0)
  • Mea_ Profile Picture
    60,284 on at

    Hi ChrisR75,

    What code do you have already ?

  • Community Member Profile Picture
    on at

    I wrote some code to generate a xml but the structure looks different.

    xml2.JPG

  • Suggested answer
    Mea_ Profile Picture
    60,284 on at

    As far as I understand, you want to use attributes, to create one you can use xmlElement.setAttribute() method, here is an example how to use it axzaptech.wordpress.com/.../create-xml-and-write-to-file-in-dynamics-ax

  • Suggested answer
    Vilmos Kintera Profile Picture
    46,149 on at

    Have you written the code in AX X++, or in Visual Studio and use it as a .Net reference class library?

    There are a lot of examples out there on how to do this in C#, I would recommend going down that route:

    msdn.microsoft.com/.../ms256237%28v=vs.110%29.aspx

    stackoverflow.com/.../xelement-adds-an-xmlns

  • Community Member Profile Picture
    on at

    Hi it is not really like the Attributes because there you have the value enclosed by "" but not the xml they want to have. there you have the type <string> </string> beside the value

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

    Please, be more specific, it's not clear what you need from us.

    My guess it that you simply called .xml() method on a table buffer and you don't understand at all how to generate XML with element names defined by yourself. Is my guess correct? If so, let's talk about the XmlDocument class...

  • Verified answer
    Mea_ Profile Picture
    60,284 on at

    You can add Tag <Field> with attribute FieldName that has a value "Person" then add child tag <String> with value 1005 and so on.

  • Community Member Profile Picture
    on at

    hi Martin

    no first I used the XmlWriter class with the method WriteAttributeString and than it looked like this:

    xml3.JPG

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

    Okay, let's stop guessing. Please show us your code (generating XML) and explain what's the problem you need help with.

    Also try asking some questions, instead of just showing a piece of XML code.

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
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans