XML childnodes

wester
Member Posts: 33
Hi there
I have a problem extracting XML content, and insert it into a Navision table.
The code looks like this:
XMLDocument.loadXML(RecordSet2.Fields.Item(xmlstring).Value);
XMLNodeList := XMLDocument.getElementsByTagName('CUBE/khoved'));
XMLNode := XMLNodeList.item(0);
REPEAT
MESSAGE(FORMAT(XMLNode.nodeTypedValue));
XMLNode := XMLNodeList.nextNode; // Next Node Element
UNTIL ISCLEAR(XMLNode);
I've created the following automation variables:
Name DataType Subtype
XMLDocument Automation 'Microsoft XML, v4.0'.DOMDocument
XMLNodeList Automation 'Microsoft XML, v4.0'.IXMLDOMNodeList
XMLNode Automation 'Microsoft XML, v4.0'.IXMLDOMNode
The XML-string looks like this:
<?xml version="1.0" encoding="ISO-8859-1"?>
<CUBE>
<khoved>
<khoved_id>10001</khoved_id>
<khoved_mindeltagere>0</khoved_mindeltagere>
<khoved_maxdeltagere>0</khoved_maxdeltagere>
</khoved>
</CUBE>
I need to extract all the tag-names (NodeName) and the values (nodeTypedValue), so I can insert them into a Navision table.
My problem is that when I write: XMLNode.nodeTypedValue I get all values in a long row. The XML-string has only one node (khoved) and several childnodes. How can I loop through all childnodes and extract the values?
Thank you in advance
/René
I have a problem extracting XML content, and insert it into a Navision table.
The code looks like this:
XMLDocument.loadXML(RecordSet2.Fields.Item(xmlstring).Value);
XMLNodeList := XMLDocument.getElementsByTagName('CUBE/khoved'));
XMLNode := XMLNodeList.item(0);
REPEAT
MESSAGE(FORMAT(XMLNode.nodeTypedValue));
XMLNode := XMLNodeList.nextNode; // Next Node Element
UNTIL ISCLEAR(XMLNode);
I've created the following automation variables:
Name DataType Subtype
XMLDocument Automation 'Microsoft XML, v4.0'.DOMDocument
XMLNodeList Automation 'Microsoft XML, v4.0'.IXMLDOMNodeList
XMLNode Automation 'Microsoft XML, v4.0'.IXMLDOMNode
The XML-string looks like this:
<?xml version="1.0" encoding="ISO-8859-1"?>
<CUBE>
<khoved>
<khoved_id>10001</khoved_id>
<khoved_mindeltagere>0</khoved_mindeltagere>
<khoved_maxdeltagere>0</khoved_maxdeltagere>
</khoved>
</CUBE>
I need to extract all the tag-names (NodeName) and the values (nodeTypedValue), so I can insert them into a Navision table.
My problem is that when I write: XMLNode.nodeTypedValue I get all values in a long row. The XML-string has only one node (khoved) and several childnodes. How can I loop through all childnodes and extract the values?
Thank you in advance

/René
0
Comments
-
0
-
Hi Thomas
Thanks, that was what I needed ;-)0 -
Thanks to Jan Hoek0
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