issue with XML (specific DTD) edit with powershell

Haema

New Member
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...\[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)\[/code\]Though it is pretty much the same I also tried doing..\[code\]$xmlDoc = [XML](gc $strXMLFile) $xmldoc.Fruit.Metadata.AMS.Name = $strName$xmldoc.Save($strXMLFile)\[/code\]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. \[code\]<!DOCTYPE ADI SYSTEM "ADI.DTD">\[/code\]to\[code\]<!DOCTYPE ADI SYSTEM "ADI.DTD"[]>\[/code\]Any inputs is appreciated
 
Back
Top