Click here to Skip to main content
15,845,055 members
Home / Discussions / XML / XSL
   

XML / XSL

 
QuestionA way to view and edit a xml file in the web browser Pin
Member 879241431-May-12 5:17
Member 879241431-May-12 5:17 
AnswerRe: A way to view and edit a xml file in the web browser Pin
Jim Meadors7-Jun-12 20:30
Jim Meadors7-Jun-12 20:30 
AnswerRe: A way to view and edit a xml file in the web browser Pin
Ger Hayden22-Jul-12 9:24
Ger Hayden22-Jul-12 9:24 
Questiona free xml tool to acquire xpath Pin
Qinbo ZHOU29-May-12 20:38
Qinbo ZHOU29-May-12 20:38 
QuestionXML Schema problem Pin
The_Infinite27-Apr-12 0:42
The_Infinite27-Apr-12 0:42 
AnswerRe: XML Schema problem Pin
Member 794572714-May-12 4:22
Member 794572714-May-12 4:22 
QuestionRemove a XMLnode - Pls help Pin
harvid24-Apr-12 19:24
harvid24-Apr-12 19:24 
AnswerRe: Remove a XMLnode - Pls help Pin
VJ Reddy24-Apr-12 23:02
VJ Reddy24-Apr-12 23:02 
The ReplaceChild method of XmlNodeclass explained here http://msdn.microsoft.com/en-us/library/system.xml.xmlnode.replacechild.aspx[^] can be used for replacing the desired nodes as shown below:
C#
void Main()
{
    string xmlCounters =
    @"<GetCountersResult>
          <GetCountsResult xmlns="""">
             <Count>
                   <ID>FP108MR</ID>
                   <Value>0</Value>
                   <Part>Z9999</Part>
             </Count>
          </GetCountsResult>
          <GetCountsResult xmlns="""">
             <Count>
                   <ID>FP108MR No2</ID>
                   <Value>0 No2</Value>
                   <Part>Z9999 No2</Part>
             </Count>
          </GetCountsResult>
    </GetCountersResult>";

    XmlDocument xmlDoc = new XmlDocument();
    xmlDoc.LoadXml(xmlCounters);
    var countNodes = xmlDoc.GetElementsByTagName("Count");
    //foreach throws, the element list has changed, error
    for (int i=0; i < countNodes.Count; i++)
    {
        xmlDoc.DocumentElement.ReplaceChild(countNodes[i], countNodes[i].ParentNode);
    }
    string fileName = @"F:\ModifiedXml.xml";
    xmlDoc.Save(fileName);
}

//The contents of file

//  <GetCountersResult>
//      <Count>
//          <ID>FP108MR</ID>
//          <Value>0</Value>
//          <Part>Z9999</Part>
//      </Count>
//      <Count>
//          <ID>FP108MR No2</ID>
//          <Value>0 No2</Value>
//          <Part>Z9999 No2</Part>
//      </Count>
//  </GetCountersResult>


modified 25-Apr-12 4:34am.

GeneralRe: Remove a XMLnode - Pls help Pin
harvid24-Apr-12 23:59
harvid24-Apr-12 23:59 
GeneralRe: Remove a XMLnode - Pls help Pin
VJ Reddy25-Apr-12 0:17
VJ Reddy25-Apr-12 0:17 
GeneralHow to specify a Hex value in XML? Pin
Frank W. Wu9-Apr-12 12:47
Frank W. Wu9-Apr-12 12:47 
AnswerRe: How to specify a Hex value in XML? Pin
PJ Arends9-Apr-12 17:09
professionalPJ Arends9-Apr-12 17:09 
GeneralRe: How to specify a Hex value in XML? Pin
jschell10-Apr-12 9:48
jschell10-Apr-12 9:48 
QuestionWhat is it called? Pin
PJ Arends7-Apr-12 22:32
professionalPJ Arends7-Apr-12 22:32 
QuestionGetting values with template Pin
memorexr24-Mar-12 5:48
memorexr24-Mar-12 5:48 
AnswerRe: Getting values with template Pin
PIEBALDconsult26-Mar-12 9:21
mvePIEBALDconsult26-Mar-12 9:21 
QuestionXmlDocument.SelectNodes not working for namespace attributes Pin
PIEBALDconsult23-Mar-12 13:23
mvePIEBALDconsult23-Mar-12 13:23 
AnswerRe: XmlDocument.SelectNodes not working for namespace attributes Pin
woopsydoozy26-Mar-12 12:08
woopsydoozy26-Mar-12 12:08 
GeneralRe: XmlDocument.SelectNodes not working for namespace attributes Pin
PIEBALDconsult26-Mar-12 17:52
mvePIEBALDconsult26-Mar-12 17:52 
GeneralRe: XmlDocument.SelectNodes not working for namespace attributes Pin
PIEBALDconsult28-Mar-12 6:26
mvePIEBALDconsult28-Mar-12 6:26 
GeneralRe: XmlDocument.SelectNodes not working for namespace attributes Pin
woopsydoozy28-Mar-12 6:53
woopsydoozy28-Mar-12 6:53 
GeneralRe: XmlDocument.SelectNodes not working for namespace attributes Pin
PIEBALDconsult28-Mar-12 11:24
mvePIEBALDconsult28-Mar-12 11:24 
GeneralRe: XmlDocument.SelectNodes not working for namespace attributes Pin
woopsydoozy28-Mar-12 11:52
woopsydoozy28-Mar-12 11:52 
GeneralRe: XmlDocument.SelectNodes not working for namespace attributes Pin
PIEBALDconsult28-Mar-12 19:14
mvePIEBALDconsult28-Mar-12 19:14 
QuestionXPath query to return nodes based on a range within an attribute's value. Pin
Bill.Moo13-Mar-12 7:21
Bill.Moo13-Mar-12 7:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.