[Openroad-users] MSXML External Class problems
Pachet, Roger (STEM)
Roger.Pachet at gov.mb.ca
Sat Nov 17 07:14:07 EST 2007
Hi All,
I am trying to use MSXML in order to create a very simple XML file using
OpenROAD but am running into a few issues. If I run the code the
Attribute 'xmlns:mms', 'http://www.whatever.com/mms' never gets put into
the XML file. (see testxml_OR.xml) However if I step through using
debug and attempt to display mydoc and its underlying node information,
the XML file gets generated properly. (see testxml_VB.xml) Note that
if I don't try to view the node information in debug the file will not
generate properly. Any one know what might be going on??
Also when using debug to attempt to view the aforementioned info much
of the relevant info of mydoc and its underlying node information is not
displayed. I get the following in the trace window when I attempt to
display the node node and element info:
E_WT0029 Error at line 1081 of scriptwin.
E_WT006D The invocation of an external object method failed.
The method 'instancereferences' for source '<missing>' returned an
error
code of 80020003 and the error message:
'<missing>'
E_WT006D The invocation of an external object method failed.
The method 'instanceidentifier' for source '<missing>' returned an
error
code of 8002000E and the error message:
'<missing>'
Am I doing something wrong....are we not able to view external object
info in OR debug?
This following code is from a frame that I created that simply has a
button which invokes this event. MSXML60 is the external class
reference that I had created in order to use XMLDOM
on click b_cmdCreateXML =
declare
myDoc = DOMDocument60 default null;
myNode =IXMLDOMNode default null;
FirstNode = IXMLDOMNode default null;
SecondNode = IXMLDOMNode default null ;
ThirdNode = IXMLDOMNode default null;
ID = IXMLDOMAttribute default null;
oRoot = IXMLDOMElement default null;
oNode = IXMLDOMNode default null;
enddeclare
{
myDoc = msxml60!DOMDocument60.Create();
myDoc.preserveWhiteSpace = False;
myDoc.async = False;
myDoc.resolveExternals = True;
/* Create processing instruction*/
oNode = myDoc.createProcessingInstruction('xml', 'version=''1.0''
encoding=''UTF-8''');
oNode = myDoc.insertBefore(oNode, myDoc.childNodes.Item(0));
/* Create root element */
oRoot = myDoc.createElement('mms:RootLevel');
myDoc.documentElement = oRoot;
/* Create the ID attribute node for the root */
ID = myDoc.createAttribute('id');
ID.Value = '1';
oRoot.Attributes.setNamedItem(ID);
oRoot.setAttribute('xmlns:mms', 'http://www.whatever.com/mms'); /*
**** this does not appear
in XML file being created ****
myNode = oRoot;
FirstNode = myDoc.createElement('mms:First');
SecondNode = myDoc.createElement('mms:Second');
ThirdNode = myDoc.createElement('mms:Third');
FirstNode.appendChild(myDoc.createTextNode('1'));
SecondNode.appendChild(myDoc.createTextNode('2'));
ThirdNode.appendChild(myDoc.createTextNode('3'));
/* Add the new nodes to the root node */
myNode.appendChild(FirstNode);
myNode.appendChild(SecondNode);
myNode.appendChild(ThirdNode);
myDoc.Save('c:\testxml.xml');
}
Out of curiosity I created the same code in VB just to see if I could
shed some light on what might be going on. Here is the same code in
VB...it works just fine. This leads me to believe I have either done
something wrong in implementing this in OR or something is wrong with
OR.
Private Sub Command2_Click()
Dim MyDoc As DOMDocument60
Dim MyNode As IXMLDOMNode
Dim FirstNode As IXMLDOMNode
Dim SecondNode As IXMLDOMNode
Dim ThirdNode As IXMLDOMNode
Dim ID As IXMLDOMAttribute
Dim oRoot As IXMLDOMElement
Dim oNode As IXMLDOMNode
Set MyDoc = New DOMDocument60
MyDoc.preserveWhiteSpace = False
MyDoc.async = False
MyDoc.resolveExternals = True
' Create processing instruction and document root
Set oNode = MyDoc.createProcessingInstruction("xml",
"version=""1.0"" encoding=""UTF-8""")
Set oNode = MyDoc.insertBefore(oNode, MyDoc.childNodes.Item(0))
' Create the root element
Set oRoot = MyDoc.createElement("mms:RootLevel")
Set MyDoc.documentElement = oRoot
' Create the ID attribute node for the root
Set ID = MyDoc.createAttribute("id")
ID.Value = "1"
oRoot.Attributes.setNamedItem ID
oRoot.setAttribute "xmlns:mms", "http://www.whatever.com/mms
<http://www.whatever.com/mms> "
Set MyNode = oRoot
Set FirstNode = MyDoc.createElement("mms:First")
Set SecondNode = MyDoc.createElement("mms:Second")
Set ThirdNode = MyDoc.createElement("mms:Third")
FirstNode.appendChild MyDoc.createTextNode("1")
SecondNode.appendChild MyDoc.createTextNode("2")
ThirdNode.appendChild MyDoc.createTextNode("3")
' Add the new nodes to the root node
MyNode.appendChild FirstNode
MyNode.appendChild SecondNode
MyNode.appendChild ThirdNode
MyDoc.save ("c:\testxml_VB.xml")
End Sub
I am using OpenROAD 4.1 / 0302. on XP Pro sp2
Sorry for the lengthy post....any help or advice would be greatly
appreciated.
Regards
Roger
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.peerlessit.com/pipermail/openroad-users/attachments/20071116/8070e309/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testxml_VB.xml
Type: text/xml
Size: 194 bytes
Desc: testxml_VB.xml
Url : http://www.peerlessit.com/pipermail/openroad-users/attachments/20071116/8070e309/attachment.xml
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testxml_OR.xml
Type: text/xml
Size: 154 bytes
Desc: testxml_OR.xml
Url : http://www.peerlessit.com/pipermail/openroad-users/attachments/20071116/8070e309/attachment-0001.xml
More information about the Openroad-users
mailing list