Simple XML export with .NET?
thomast
Member Posts: 102
Hi Guys,
Could anyone tell me how to make a codeunit which can export a couple of fields from the customer table in XML but using the .NET xml variable called system.xml?
I am trying to understand how the basics of this works and would expect this could be done in a couple of lines of code....
Thank you!!! :-)
Thomas.
Could anyone tell me how to make a codeunit which can export a couple of fields from the customer table in XML but using the .NET xml variable called system.xml?
I am trying to understand how the basics of this works and would expect this could be done in a couple of lines of code....
Thank you!!! :-)
Thomas.
0
Comments
-
I recommend that you look at 6224 XML DOM Management.
Just start with calling the constructor and from there it's just using the XMLDOMMgt.AddElement method.XMLResultDoc:= XMLResultDoc.XmlDocument; XMLResultDoc.LoadXml('<?xml version="1.0" encoding="utf-8" ?><root/>'); XMLRootNode := XMLResultDoc.DocumentElement; XMLDOMMgt.AddElement(XMLRootNode, 'description', '', XMLRootNode.NamespaceURI, XMLCreatedNode);Types:Name DataType Subtype Length XMLDOMMgt Codeunit XML DOM Management XMLResultDoc DotNet System.Xml.XmlDocument.'System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' XMLCreatedNode DotNet System.Xml.XmlNode.'System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' XMLRootNode DotNet System.Xml.XmlNode.'System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
The code above will produce:<?xml version="1.0" encoding="utf-8" ?> <root> <description/> </root>
From there you have the XMLCreatedNode which you can add to to create a child to your description element.
Remember that if you want to save, you should use XMLResultDoc.Save('Filename')
Edit: forgot the types.0 -
But XMLRootNode, what type should be? Could you make a reference to other tutorials regarding .NET in C/AL?0
-
Hi Andreea.
I just edited my post to contain the XMLRootNode type.
I don't have a reference for .NET in C/AL. I just try and see what works.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 322 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions