I have this piece of xml code that I can trying to add to a file on my pc:
<Connector port="9089" protocol="org.apache.coyote.http11.Http11NioProtocol"/>
The code I have been trying to use:
$config = New-Object System.Xml.XmlDocument
$config.Load($filePath)
$newElement = $config.CreateElement('Connector')
$newElement.InnerXml = 'port="9089" protocol="org.apache.coyote.http11.Http11NioProtocol"'
$config.Server.Service.AppendChild($newElement)
$config.Save($filePath)
But instead of the desired output above, the code adds the following to the xml file:
<Connector>
port="9089" protocol="org.apache.coyote.http11.Http11NioProtocol"
</Connector>
What changes could I make to the code to get the above output rather than the below?