I am dealing with a bunch of VOD meta data files (XML). There is an ADI.DTD that defines the schema of my xml.
I am trying to use powershell to edit this xml and update/change a tag using the following piece of powershell code...
[System.Xml.XmlDocument]$doc =
new-object System.Xml.XmlDocument;
$doc.Load($strXMLFile);
$root = $doc.get_DocumentElement();
$root.Fruit.Metadata.AMS.Name = $strName
$doc.Save($strXMLFile)
Though it is pretty much the same I also tried doing..
$xmlDoc = [XML](gc $strXMLFile)
$xmldoc.Fruit.Metadata.AMS.Name = $strName
$xmldoc.Save($strXMLFile)
This save is changing more than the one tag I wanted it to. It is deleting few carriage returns and appending this weird [] to my DOCTYPE.. I don't understand why it is doing it and don't know the downward impact on systems that consume this XML.
<!DOCTYPE ADI SYSTEM "ADI.DTD">
to
<!DOCTYPE ADI SYSTEM "ADI.DTD"[]>
Any inputs is appreciated