MSXMLDOM6 How to add a namespace

jwilder
Member Posts: 263
I am reading an xml document that has a namespace (xmlns="http://www.demandware.com/xml/impex/order/2006-10-31"). Findnode does not work when the namespace is in the file. If I remove the namespace from teh xml file then findnode works. The work around is to add a namepsace using the xmldom. I know how to do this in NAV using .net (System.XML) as there is a namespacemanager and you do something like this:
XMLNamespaceMgr := XMLNamespaceMgr.XmlNamespaceManager(XMLRootNode.OwnerDocument.NameTable);
XMLNamespaceMgr.AddNamespace(Prefix,NameSpace);
How do I do this using the 'Microsoft XML, v6.0' Automation Server? Possibly something with declareprefix method?
XMLNamespaceMgr := XMLNamespaceMgr.XmlNamespaceManager(XMLRootNode.OwnerDocument.NameTable);
XMLNamespaceMgr.AddNamespace(Prefix,NameSpace);
How do I do this using the 'Microsoft XML, v6.0' Automation Server? Possibly something with declareprefix method?
Jason Wilder
jwilder@stonewallkitchen.com
jwilder@stonewallkitchen.com
0
Comments
-
There is some hope with:
XMLDoc.setProperty('SelectionNamespaces','xmlns="http://www.demandware.com/xml/impex/order/2006-10-31"');
It compiles but does not do the trick, unfortunately.Jason Wilder
jwilder@stonewallkitchen.com0 -
Let me rephrase my question as I am sure someone has solved this.
In NAV 2015 Codeunit 6224 has a function called FindNodeWithNamespace. This uses dotnet System.XML library. If you go back a few versions of NAV this function did not exist in this codeunit yet. Instead of using dotnet System.XML the older version of this codeunit used automation MSXML Version 3 to accomplish the same thing. So I am trying to recreate the FindNodeWithNamespace Function using automation instead of dotnet.
Anyone?
Jason Wilder
jwilder@stonewallkitchen.com0 -
You can define a var like 'Microsoft XML, v6.0'.IXMLDOMElement and then use the method setAttribute to do that.
Regards0
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