I am trying to push my output from VBScript code in table row and table cell.
My code is:
Set table = document.CreateElement("table")
i = 0
For Each node In objMSXML.selectNodes(sXPath)
Set tr = document.createElement("tr")
Set td = document.createElement("td")
For Each element In node
td.innerText = element.parentNode.nodeName & "->" & element.text
tr.appendChild td
Next
table.appendChild tr
ObjOutFile.WriteLine node.parentNode.nodeName & "->" & node.text
i = i + 1
Next
document.body.appendChild table
What is wrong with it? it is not working while I am able to push output in list.
Edit I am using this code it prints output as expected but table is not populated.
ObjOutFile.WriteLine thing.path
document.body.appendChild p
Set tbody = document.createElement("tbody")
For Each node In objMSXML.selectNodes(sXPath)
Set trow = document.createElement("tr")
Set tcol = document.createElement("td")
tcol.innerText = tcol.innerText & node.parentNode.nodeName & "->" & node.text
ObjOutFile.WriteLine node.parentNode.nodeName & "->" & node.text
trow.appendChild(tcol)
tbody.appendChild(trow)
'ObjOutFile.WriteLine node.parentNode.nodeName & "->" & node.text
Next
document.appendChild(tbody)
The ObjOutFile.writeLine
prints like:
C:\Users\abc\Desktop\samp.txt hamster->AbcPos hamster->Database Layer hairyStyle->qskxyz hairyGirl->qixyz hairyGirl->abc hairyGirl->def