I am trying to read XML content from which is stored in a text file. But it is not working properly. Please go through my code as mention below:
Write-Host 'Welcome'
$path='D:\SOAP\PozEncoXML.txt'
$xml=[xml](Get-Content -path $path)
Write-Host 'File Content'
write-host $xml
$node= $xml.Envelope.Body.uploadFileToUcm.document.Content='Hello world'
Write-Host $node
In line no 3 of the above code I am trying to read XML content from the text file. If I remove [xml] then Get-Content is working fine. But need that content in XML format. Can anyone help me to overcome this issue?
This is the content of my file content
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://xmlns.oracle.com/apps/financials/commonModules/shared/financialUtilService/types/" xmlns:fin="http://xmlns.oracle.com/apps/financials/commonModules/shared/financialUtilService/">
<soapenv:Header/>
<soapenv:Body>
<typ:uploadFileToUcm>
<typ:document>
<fin:Content></fin:Content>
<fin:FileName>xxxxx.csv</fin:FileName>
<fin:ContentType>csv</fin:ContentType>
<fin:DocumentTitle>Journal Import</fin:DocumentTitle>
<fin:DocumentAuthor>xxxx</fin:DocumentAuthor>
<fin:DocumentSecurityGroup>FAFusionImportExport</fin:DocumentSecurityGroup>
<fin:DocumentAccount>fin$/generalLedger$/import$</fin:DocumentAccount>
<fin:DocumentName>?</fin:DocumentName>
<fin:DocumentId>?</fin:DocumentId>
</typ:document>
</typ:uploadFileToUcm>
</soapenv:Body>
</soapenv:Envelope>
Thank you in Advance
$xml.Envelope.Body.uploadFileToUcm.document.Content='Hello world'- the second=is an assignment not a comparison which might mean the rest of your program doesn't behave how you expect...