Read XML File using Codeunit

julkifli33
Member Posts: 1,092
Hi All,
is there a way to read XML file using codeunit ?
lets say like this simple file
thanks
is there a way to read XML file using codeunit ?
lets say like this simple file
thanks
<?xml version="1.0" encoding="UTF-16" standalone="no"?> <Data> <Ledger> <ItemNo>PO-000001</ItemNo> <Qty>CR-0001</Qty> </Ledger> <Ledger> <ItemNo>PO-000001</ItemNo> <Qty>CR-0003</Qty> </Ledger> <Ledger> <ItemNo>PO-000001</ItemNo> <Qty>CR-0002</Qty> </Ledger> <Ledger> <ItemNo>PO-000001</ItemNo> <Qty>CR-0003</Qty> </Ledger> </Data>
0
Comments
-
It is not problem (of course, I do not know why you do not want to use XMLPort...) -you can use DotNet assembly to read xml like from c#...0
-
i need to publish via codeunit
and do some coding inside codeunit
so I thought it's better just use 1 object
and XML port we cant import data using fixed path
(correct me if i'm wrong... user must browse first)0 -
user doesn't need to specify the path. you can open the file through code and pass the stream to the xmlport.0
-
how to set that?
i already fill the default name file
but still need to browse before import0 -
If you want to import this XML as part of some webservice call, you can use XMLPort as parameter in the codeunit function and publish this codeunit. The xmlport will "define" the structure of the parameter (but I am not sure if you will be able to create the exact structure you need)
Another way is to use BigText parameter, into which the XML is passed as value and you can than stream the text into XMLPort or DotNet assembly.0 -
kine wrote:If you want to import this XML as part of some webservice call, you can use XMLPort as parameter in the codeunit function and publish this codeunit. The xmlport will "define" the structure of the parameter (but I am not sure if you will be able to create the exact structure you need)
Another way is to use BigText parameter, into which the XML is passed as value and you can than stream the text into XMLPort or DotNet assembly.
so what you mean is like this
lets say i have 1 function named ImportData
give this function 1 parameter
and then from webservice i should call this function including the parameter
example --> ImportData(Test.xml)
is it like this?0 -
If I understand your code, no. It will pass the file name. Or if the paramter will be the xml itself, than yes, what you will pass will end in the parameter in NAV.0
-
hi now i can read XML data
now the problem is...
previously i use nav 2009 to develop this codeunit
after i export this object, and then i move it to my 2013 database
(the same computer)
there is an error message :
You cannot create an Automation object "xmldomDoc" on Microsoft Dynamics NAV Server. You must create it on a client computer.
i have variable name xmldomDoc
Data type : Automation
Sub type : 'Microsoft XML, v6.0'.DOMDocument
anything wrong? or something i must set up first0 -
Automations could be used only client side on NAV 2013. You need to use DotNet Assembly instead.0
-
kine wrote:Automations could be used only client side on NAV 2013. You need to use DotNet Assembly instead.
example perhaps0 -
You can start here: http://msdn.microsoft.com/en-us/library/gg502499.aspx
There is assembly System.Xml.XmlDocument0 -
kine wrote:You can start here: http://msdn.microsoft.com/en-us/library/gg502499.aspx
There is assembly System.Xml.XmlDocument0 -
kine wrote:You can start here: http://msdn.microsoft.com/en-us/library/gg502499.aspx
There is assembly System.Xml.XmlDocument
anyway any sample for this thing?0 -
0
-
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
- 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