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)

Creating Class from xsd-file (AX 2012)

(0) ShareShare
ReportReport
Posted on by 1,085

Hello,

Are there any tools/utility classes to create a class in runtime or with a tool from command prompt using xsd file?

I mean same kind of utility than xsd.exe in .NET.

Thanks,

Michael

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Joris dG Profile Picture
    17,775 on at

    Technically you could manipulate AOT TreeNode directly, but there is a class called "ClassBuild" which is easy to use.

  • Michael_Land Profile Picture
    1,085 on at

    Hello, I coudn't  find any samples how to create X++ class in code from XMLSchema (xsd) using ClassBuild.

    I didn't also find any tool like xsd.exe to generate X++ class from .xsd file.

    Are there any samples to do this or any tools available?

    Thanks,

    Michael

  • Suggested answer
    Joris dG Profile Picture
    17,775 on at

    The tools you're asking for are not available to my knowledge. The ClassBuild class allows you to create a new class so that would be your starting point to implement the feature you need.

  • Michael_Land Profile Picture
    1,085 on at

    I found couple of ClassBuild examples but none of them had sample how to add member variables.

    My need is to create a quite big class containing lot's of member variables and methods.

    But I didn't find any samples how to do it. E,g. Interface of ClassBuild has changed so, that there were not AddMemberVariable anymore.

    So how to do this?

    Thanks,

    Michael

  • Suggested answer
    Amir Nazim Profile Picture
    5,994 on at

    check this link

    www.doens.be/.../create-class-from-code

  • Michael_Land Profile Picture
    1,085 on at

    Hello again,

    Still struggling with this same problem.

    The XMLSchema that is used for creating that class is 1400 lines long ...

    Are there any possibilities to create Xml Document from XML Screma and then fill it and somehow serialize it to file...

    How you others have solve this kind of issue?

    There is a long XSD based message or class that should be created and then filled wih data that exits in software and then make it as a file?

    Br

    Michael

  • Michael_Land Profile Picture
    1,085 on at

    What else came to mind was that because we use SQL Server and it can support creating Tables from XMLSchemas... has anyone tried to solve this kind of issue using Database?

    Br

    Michael

  • Suggested answer
    Joris dG Profile Picture
    17,775 on at

    I'm not entirely following your scenario. I thought you had class definitions in XML and wanted to automate the creation of those classes in X++. But now you're asking how to create the XML files, so I'm somewhat confused as to what you are trying to do exactly, and mostly why. If you still need to create the XMLs, then create the tool to import them... seems like a lot of work so the question is why. Alternatively, if you need to somehow generate code from outside of AX, consider generating an XPO file that can be imported into AX. The XPO format for classes is fairly simple to understand.

    Either way, there are tools out there to create XML instances out of schemas, some are online and free, others are tools you can purchase. If you have Microsoft Office including InfoPath you can try using InfoPath for this, but it may require some cleanup of the resulting XML.

  • Michael_Land Profile Picture
    1,085 on at

    Thanks for answering!

    So the clearified situation is this.

    a) I have a Invoice XSD which should be used to get a XML file that is compability with this invoice XSD.

    b) First  I should fill data from AX Database to a Class or XML Document which is compability  with XSD Schema above

    c) After filling data into Class or XML Document which is compability with XSD Schema I should write that into filesystem.

    That is the basic flow. Because XML Schema has so much variables, collections etc I can't do it with basic programming meaning going one by one with every variable.

    Is this any clearer? :)

    Br

    Michael

  • Suggested answer
    Joris dG Profile Picture
    17,775 on at

    Have you considered dumping the AX invoice to a regular AX XML file, then using an XSLT to transform the XML into an XML your XSD can validate?

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