'How to create XML using for loop
I want to create an XML inside the for loop using all the values fetched using for loop.
when for loop runs I get a value for field "user" and field "IS Active in AD" and I want to store all the values of "user" and "is active in ad" in the below format:
<outputs>
<output>
<user>value</user>
<Active>value</Active>
</output>
<output>
<user>value1</user>
<Active>value1</Active>
</output>
'
'
<output>
<user>valuen</user>
<Active>valuen</Active>
</output>
</outputs>
Solution 1:[1]
if you're using javascript with this you can do a foreach loop to do this I just never really used XML so maybe something like this
foreach(var value in User){
var dataStuff = `<rows><column>{user.name, user.email, etc..} </column></rows>`
getElementByID("ElementName").append(dataStuff);
so I don't know maybe it can be easy like this I don't understand what you really asking for without your code
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | daddycardona |