novice here trying to use powershell to return the text within cdata tags within multiple files in a folder structure and then write to a csv.
The other option would be to trim either side of the cdata on output as it could appear at different positions within a line.
Thanks in advance.
The below returns the file name, line and cdata tags but with variable spacing but really just after the contents within the cdata..
Get-ChildItem -Path "C:\temp" -Filter "*.xml" -Recurse |
Where-Object { !$_.PSItem } |
Select-String "\[[^\[\]]*?\]" -Pattern > export.csv
The xml will look something like this:
<Name> <![CDATA[value]]>. </Name>
<Name><![CDATA[value]]></Name>
<Name> <![CDATA[value]]</Name>