You'll need to properly specify and use XML namespaces. See http://www.mail-archive.com/wix-users@lists.sourceforge.net/msg42889.html
Edwin G. Castro Software Developer - Staff Electronic Banking Services Fiserv Office: 503-746-0643 Fax: 503-617-0291 www.fiserv.com Please consider the environment before printing this e-mail > -----Original Message----- > From: Wilson, Brian [mailto:brian.wil...@dhr.alabama.gov] > Sent: Tuesday, January 18, 2011 12:29 PM > To: 'WiX-users@lists.sourceforge.net' > Subject: [WiX-users] Modify Heat Generated Fragment with C# > > Hello, > > I have a Heat generated WXS file that I am trying to modify, so I can add the > shortcut node to the file node for my application. I am trying to use a C# > program to do this for me. > > I am using the following code: > > XmlDocument xmlDoc = new XmlDocument(); > xmlDoc.Load(@"C:\Wix Files\wix_import.wxs"); > > XmlNode xmlWiX = xmlDoc.DocumentElement; > > XmlNode xmlrplc = > xmlWiX.SelectSingleNode(@"File[@Source='!(wix.ImportSrc)\TestImportAp > p.exe']"); > XmlNode xmlparent = xmlrplc.ParentNode; ** Errors here*** > xmlparent.RemoveChild(xmlrplc); > > xmlsrc.Save(@"~\modded_wix_import.wxs"); > > The attribute is not found, so I thought I would just find the node, so I > tried: > XmlDocument xmlDoc = new XmlDocument(); > xmlDoc.Load(@"C:\Wix Files\wix_import.wxs"); > > XmlNode xmlWiX = xmlDoc.DocumentElement; XmlNode xmlrplc = null; > > XmlNode xmlComp = xmlWiX.SelectNodes("/Component"); XmlNodeList > xmlList = xmlComp.ChildNodes; ** Errors here*** > > foreach (XmlNode xmlChild in xmlList) > { > if (xmlChild.Name == "File") > { > if (xmlChild.Attributes["Source"].Value == > "!(wix.ImportSrc)\TestImportApp.exe") > { > xmlrplc = xmlChild; > } > } > } > > XmlNode xmlparent = xmlrplc.ParentNode > xmlparent.RemoveChild(xmlrplc) > > xmlsrc.Save(@"~\modded_wix_import.wxs") > > It seems the XML library is having a difficult time traversing the XML > document. Has anyone done something like this and if so, what am I doing > wrong? > > > Thank you, > > Brian Wilson > Department of Human Resources - Administrative Services > Email: brian.wil...@dhr.alabama.gov > > > > ------------------------------------------------------------------------------ > Protect Your Site and Customers from Malware Attacks Learn about various > malware tactics and how to avoid them. Understand malware threats, the > impact they can have on your business, and how you can protect your > company and customers by using code signing. > http://p.sf.net/sfu/oracle-sfdevnl > _______________________________________________ > WiX-users mailing list > WiX-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wix-users ------------------------------------------------------------------------------ Protect Your Site and Customers from Malware Attacks Learn about various malware tactics and how to avoid them. Understand malware threats, the impact they can have on your business, and how you can protect your company and customers by using code signing. http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users