Add namespace prefix to every node when exporting XML?

Tiwaz
Member Posts: 98
Hi everyone.
I want to have, instead of this:
<PodaciPoreskeDeklaracije xmlns='http://pid.purs.gov.rs'>
<PodaciOPrijavi>
<VrstaPrijave>1</VrstaPrijave>
<ObracunskiPeriod>2016-10</ObracunskiPeriod>
<DatumDospelostiObaveze>2016-01-05</DatumDospelostiObaveze>
.
.
.
THIS
<ns1:PodaciPoreskeDeklaracije
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xmlns:ns1='http://pid.purs.gov.rs'>
<ns1:PodaciOPrijavi>
<ns1:VrstaPrijave>1</ns1:VrstaPrijave>
<ns1:ObracunskiPeriod>2016-10</ns1:ObracunskiPeriod>
<ns1:DatumDospelostiObaveze>2016-01-05</ns1:DatumDospelostiObaveze>
.
.
.
.
How can I add this ns1: prefix to each element and how can I insert xsi schema namespace too?
I added http://pid.purs.gov.rs in namespace property but that does just this: xmlns='http://pid.purs.gov.rs'
THANKS
I want to have, instead of this:
<PodaciPoreskeDeklaracije xmlns='http://pid.purs.gov.rs'>
<PodaciOPrijavi>
<VrstaPrijave>1</VrstaPrijave>
<ObracunskiPeriod>2016-10</ObracunskiPeriod>
<DatumDospelostiObaveze>2016-01-05</DatumDospelostiObaveze>
.
.
.
THIS
<ns1:PodaciPoreskeDeklaracije
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xmlns:ns1='http://pid.purs.gov.rs'>
<ns1:PodaciOPrijavi>
<ns1:VrstaPrijave>1</ns1:VrstaPrijave>
<ns1:ObracunskiPeriod>2016-10</ns1:ObracunskiPeriod>
<ns1:DatumDospelostiObaveze>2016-01-05</ns1:DatumDospelostiObaveze>
.
.
.
.
How can I add this ns1: prefix to each element and how can I insert xsi schema namespace too?
I added http://pid.purs.gov.rs in namespace property but that does just this: xmlns='http://pid.purs.gov.rs'
THANKS

0
Answers
-
Hmm the problem is you did not say what version of NAV is it.
In NAV 2016 and later versions you can use NamespacePrefix property In XML port.
In NAV 2013 R2 - NAV 2015 with an XMLport you cna just create the file as above, and then run a separate routine to read the XMlfile and add the a name space.
(I am not aware of any other options)
In NAV 2009 you have to use the codeunit "XML DOM Management" to create the XMl file. With XMLPorts you will not get very far.
In general for all NAV versions you could use the codeunit "XML DOM Management" to create the XMl file and forget the XMLport, but this is a bit more work.
I hope this helps
Thanks.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