I am populating table using vb-script code :-
Set table = document.createElement("table")
Set tbody = document.createElement("tbody")
i = 0
For Each node In objMSXML.selectNodes(sXPath)
Set tr = document.createElement("tr")
Set td = document.createElement("td")
td.innerText = node.parentNode.nodeName & "->" & node.text
tr.appendChild td
tbody.appendChild tr
i = i +1
Next
table.appendChild tbody
document.body.appendChild table
However I want to generate multiple columns my current output is :-
universespace->Milkyway
universespace->Earth Layer
scienceSubject->Solar System
scienceItem->Earth
scienceItem->Moon
scienceItem->Mars
And I want it to be like :-
+--------------+--------------+--------------+-----------+
|universespace1|universespace2|scienceSubject|scienceItem|
+--------------+--------------+--------------+-----------+
| Milkyway | Earth Layer | Solar System | Earth |
+--------------+--------------+--------------+-----------+
| Milkyway | Earth Layer | Solar System | Moon |
+--------------+--------------+--------------+-----------+
| Milkyway | Earth Layer | Solar System | Mars |
+--------------+--------------+--------------+-----------+
I tried various other ways :-
Set table = document.createElement("table")
Set tbody = document.createElement("tbody")
i = 0
For Each node In objMSXML.selectNodes(sXPath)
Set tr = document.createElement("tr")
Select Case True
Case "namespace" = node.parentNode.nodeName
Set th = document.createElement("th")
th.innerText = node.parentNode.nodeName
tr.appendChild th
Case "namespace" = node.parentNode.nodeName
Set th1 = document.createElement("th")
th1.innerText = node.parentNode.nodeName
tr.appendChild th1
Case "querySubject" = node.parentNode.nodeName
Set th2 = document.createElement("th")
th2.innerText = node.parentNode.nodeName
tr.appendChild th2
Case "queryItem" = node.parentNode.nodeName
Set th3 = document.createElement("th")
th3.innerText = node.parentNode.nodeName
tr.appendChild th3
End Select
'td.innerText = i & node.parentNode.nodeName & "->" & i & node.text
'tr.appendChild td
tbody.appendChild tr
Still not able to get output in desired format. It is all coming in single column rather than different columns.
The answer here doesn't help me to create table with columns. It just displays a table with one row and one column i.e. table cell.