How to parse this xml?

Hello all, i’m very new to powershell, and i’m abit stuck.

I have this innerXML:


And i want to convert it into a .properties file in this format:


i have the part to create the .properties file (hardcoded value right now) which works:

$test = New-Item -Name "" -ItemType "file" -Value "test.prop=testprop`ntest2.prop=test2prop"

So basically i need to go from the innerXML to a big string of key/values separated by `n But also i need to escape any $ with `

desired string: sl-test.protocol=HTTP`nsl-test.responseTimeout=14000`ntest`${myenv}`nhttp.port=8081

But right now i cant even seem to iterate through all the keys and values.

Note: the keys and values will be dynamic, it will not always be those 4

Any help will be greatly appreciated.

Welcome to the forum. :wave:t4:

When you crosspost the same question at the same time to different forums you should at least post links to the other forums along with your question to avoid people willing to help you making their work twice or more.


And BTW: When you post code, sample data, console output or error messages please format it as code using the preformatted text button ( </> ). Simply place your cursor on an empty line, click the button and paste your code.

Thanks in advance

How to format code in <---- Click :point_up_2:t4: :wink: