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");