Pass XML into function

rickyl76
Member Posts: 25
Hi, i have an xml file that i import manually into the system using an xmlport. I then want to convert this whole xml file to text and pass the text to a function. Can someone tell me how i can do this please?
0
Answers
-
This is 20160
-
Hello @rickyl76,
You could use something like this, the porcediure XML2Text returns a text withe the XMLFile parameter passed:OBJECT Codeunit 50050 Pass XML to Text { OBJECT-PROPERTIES { Date=09/12/21; Time=19:54:40; Modified=Yes; Version List=; } PROPERTIES { OnRun=BEGIN Txt := XML2Text('Your XML File path here'); MESSAGE(Txt); END; } CODE { VAR Txt@1000000000 : Text; PROCEDURE XML2Text@1000000000(FileName@1000000001 : Text) : Text; VAR XMLDoc@1000000000 : DotNet "'System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Xml.XmlDocument"; BEGIN XMLDoc := XMLDoc.XmlDocument; XMLDoc.Load(FileName); EXIT(XMLDoc.InnerXml); END; BEGIN END. } }
Regards0 -
Thank you very much for your help0
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
- 320 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