I have a PowerShell script:
$xmlString="<root>
<section>
<node id='1'>AAA</node>
<node id='2'>BBB</node>
<node id='3'>CCC</node>
</section>
</root>"
$xml = New-Object -TypeName System.Xml.XmlDocument
$content = $xml.LoadXml($xmlString)
Value of $content is null
Inner Exception in $xml variable is <Error retrieving property - ArgumentException>
I have checked whether string starts with [System.Text.Encoding]::UTF8.GetPreamble() but it does not.
Can you please tell, what it is correct way to convert such string to XML?
LoadXML()works. The imported XML is in the variable$xml, not$content. The method doesn't return anything, so$contentis empty.