XML Prefix via XML DOM

Djawadi
Member Posts: 3
Hello,
I am trying to create an XML-File via XML Dom.
All Tags need to have a prefix in it. And that is where I am stuck at the moment.
Here is the example code:
Now I get an Error "not declared prefix: prefixname"
Any Ideas on that? I am happy for any advice.
Rene
/Update:
If I user the line
I don't get an error, but the Tag in the XML-File looks like:
But I need it to look like:
I am trying to create an XML-File via XML Dom.
All Tags need to have a prefix in it. And that is where I am stuck at the moment.
Here is the example code:
IF ISCLEAR(XMLDocOut) THEN CREATE(XMLDocOut,TRUE); XMLDocOut.async := FALSE; XMLDocOut.validateOnParse := FALSE; XMLDocOut.resolveExternals := FALSE; XMLDocOut.loadXML(Text1140008+'<Tool.message.0300></Tool.message.0300>'); IF XMLDocOut.xml = '' THEN ERROR(LocText004); XMLCurrNode := XMLDocOut.documentElement; XMLDOMManagement.SetNormalCase; XMLDOMManagement.AddAttribute(XMLCurrNode,'xmlns:prefixname','http://valid-url'); XMLDOMManagement.AddAttribute(XMLCurrNode,'prefixname:version','1.2'); XMLDOMManagement.AddAttribute(XMLCurrNode,'prefixname:fassung','2008-12-12'); XMLDOMManagement.AddAttribute(XMLCurrNode,'xmlns:xsi','http://www.w3.org/2001/XMLSchema-instance'); XMLDOMManagement.AddAttribute(XMLCurrNode,'xsi:schemaLocation','http://validurl' + ' ' + 'http://validurl.xsd'); IF NOT RecContact.GET(Kontaktnr) THEN ERROR(LocText003,Kontaktnr); WITH XMLDOMManagement DO BEGIN IF AddElement(XMLCurrNode,'prefixname:time',TIME,'',XMLNewChild) > 0 THEN EXIT;
Now I get an Error "not declared prefix: prefixname"
Any Ideas on that? I am happy for any advice.
Rene
/Update:
If I user the line
IF AddElement(XMLCurrNode,'prefixname:time',TIME,prefixname,XMLNewChild) > 0 THEN
I don't get an error, but the Tag in the XML-File looks like:
<prefixname:time xmlns:prefixname = prefixname>
But I need it to look like:
<prefixname:time>
0
Comments
-
Ok I got it myself.
Here is the solution:IF AddElement(XMLCurrNode,'prefixname:time',TIME,http://validurl,XMLNewChild) > 0 THEN
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