XML Automation
navinb
Member Posts: 51
Hi ,
I am trying to export records in xml format with automation but it is breaking on below code :
XMLRoot := XMLDoc.documentElement;
XMLNode := XMLRoot.ownerDocument.createNode('element', 'TableRecord', '');
XMLRoot.appendChild(XMLNode);
System is throwing an error that automation variable is not instantiated .Please suggest what i am missing here
Thanks in advance !!
I am trying to export records in xml format with automation but it is breaking on below code :
XMLRoot := XMLDoc.documentElement;
XMLNode := XMLRoot.ownerDocument.createNode('element', 'TableRecord', '');
XMLRoot.appendChild(XMLNode);
System is throwing an error that automation variable is not instantiated .Please suggest what i am missing here
Thanks in advance !!
0
Comments
-
Please check if you have created all the automation variables you are using.0
-
Following variables are declared :
Name DataType Subtype Length
XMLDoc Automation 'Microsoft XML, v3.0'.DOMDocument
XMLRoot Automation 'Microsoft XML, v3.0'.IXMLDOMNode
XMLNode Automation 'Microsoft XML, v3.0'.IXMLDOMNode
And XMLDoc is created.0 -
Have you tried the simple solution just to write XMLDoc.createNode(...);?Bardur Knudsen
Microsoft - Dynamics NAV0 -
Yes even that throws the same error :"automation error is not intialised"0
-
Have you studied the patterne elsewhere in the application, e.g. REPORT 505 where an xml document is built up from scratch?Bardur Knudsen
Microsoft - Dynamics NAV0 -
Not quite sure what you are doing but in case it is any help here is a very simple way to create a 2 tag XML document using automation:
IF ISCLEAR(XMLDoc) THEN CREATE(XMLDoc); NewNode := XMLDoc.createNode(1,'DocumentElementNode','NameSpaceURI'); XMLDoc.appendChild(NewNode); CurrNode := NewNode; NewNode := XMLDoc.createNode(1,'TableRecord','NameSpaceURI'); NewNode.text := 'TestData'; CurrNode.appendChild(NewNode); XMLDoc.save('c:\tmp\test.xml');
Be advised that the error: "Automation has not been instantiated" or something to that effect can also arise when you try to select a tag in an XML document if that tag is not present. Not a very descriptive error to give but if Ie. you try to select a non-existent tag name <ThisTagIsNotInTheXML> then you will not be told that the tag does not exist. Instead you will get an Automation error if you try to use the Node without first checking with ISEMPTY if a node was actually returned.Best regards
Tommy0 -
[Topic moved from 'NAV Three Tier' forum to 'NAV/Navision Classic Client' forum]Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 328 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