Jade 5.1 and Imported MSXML.dll

For questions and postings not covered by the other forums
ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Jade 5.1 and Imported MSXML.dll

Postby ConvertFromOldNGs » Fri Aug 07, 2009 11:57 am

by Wayne Tomlinson >> Thu, 28 Sep 2000 2:09:16 GMT

I have imported the msxml.dll and have been successful at creating and adding nodes to a document but I can't seem
to create add attributes to a node.

I have used the createNode method as shown below

[rootNode.createNode(1,"rootNode",null)]

this creates a node of Element type however I can't seem to type cast the object returned to IXMLDOMElement
and therefore can't get access to the methods to add attributes.

Has anybody got this far with the msxml.dll ??

Maybe someone at Jade can try this and post a code snippet

thanks

Wayne Tomlinson
Senior Developer
Greenstone Technologies

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Jade 5.1 and Imported MSXML.dll

Postby ConvertFromOldNGs » Fri Aug 07, 2009 11:57 am

by Wayne Tomlinson >> Thu, 28 Sep 2000 3:47:47 GMT

I have solved this for anybody who cares
here is one solution.

cheers

wayne tomlinson
Greenstone Tech


xml_attribute_example() updating;

vars

xmlDoc : DOMDocument;
rootNode : IXMLDOMNode;

queryNode : IXMLDOMNode;
nodeItem : IXMLDOMNode;
nodeList :IXMLDOMNodeList;

node1 : IXMLDOMNode;
myNode :IXMLDOMNode;
namedNodeMap : IXMLDOMNamedNodeMap;
int :Integer;
int2 : Integer;begin


create xmlDoc transient;

rootNode := xmlDoc.createNode(1,"booklist",null);
xmlDoc.appendChild(rootNode);


foreach int in 1 to 10 do

node1 := xmlDoc.createNode(1, "book", "");
xmlDoc.childNodes.item(0).appendChild(node1);

myNode := xmlDoc.createNode(2, "name", "");
myNode.text :=int.String;

namedNodeMap := node1.attributes;
namedNodeMap.setNamedItem (myNode);

endforeach;


nodeList := rootNode.selectNodes("/booklist/book");

write nodeList.length.String & " : nodes have been found";
foreach int in 0 to nodeList.length -1 do
nodeItem := nodeList.item(int);

foreach int2 in 0 to 10 do
node1 := xmlDoc.createNode(1,"page",null);
nodeItem.appendChild(node1);

myNode := xmlDoc.createNode(2, "pageNumber", "");
myNode.text :=int2.String;

namedNodeMap := node1.attributes;
namedNodeMap.setNamedItem (myNode);

endforeach;
endforeach;


xmlDoc.save("c:\TestXMLOuputFromJade\test.xml");


Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 28 guests