Home > Net >  A great god, please help take a look at the following c # code into QT language, the key grammar to
A great god, please help take a look at the following c # code into QT language, the key grammar to

Time:09-23

Here is my written in C # read XML format file, need to replace C with node, all the oldname string with newname, then oldname in the name of the file also with newname, also ask god to help



XmlDocument doc=new XmlDocument ();
XmlReaderSettings Settings=new XmlReaderSettings ();
Settings. IgnoreComments=false;
String oldname;
String newname.
XmlWriterSettings set=new XmlWriterSettings ();
Set the Indent=true; ?
XmlReader reader1=XmlReader. Create (" settlement "+ oldname +". The XML ", Settings).

Doc. The Load (reader1);
XmlNodeList nodeList=doc. SelectNodes ("////a/b/c ");
for (int i=0; iReader1. Close ();
Using (XmlWriter stw1=XmlWriter. Create (" settlement "+ newname +". The XML ", set ")
{
Doc. Save (stw1);
}

CodePudding user response:

Didn't understand what the problem, "/a/b/c"?

CodePudding user response:

reference 1st floor huakai2418 response:
didn't understand what the problem, "/a/b/c"?
C is one of the third child nodes, need to replace a specific string in the string below it

CodePudding user response:

reference 1st floor huakai2418 response:
didn't understand what the problem, "/a/b/c"?
nodes, but the file several C my qt program is I can't find it

CodePudding user response:

reference 1st floor huakai2418 response:
didn't understand what the problem, "/a/b/c"?
great god see, here is my XML file similar nodes, several nodes, c I'd like to replace it in 15, please advice how to cycle, thank you
& lt; A>
& lt; b>
& lt; c>
& lt; You & gt; .
& lt; I & gt; .
& lt; It & gt; D/files/15 & lt;/it & gt;
& lt;/c>
& lt; c>
& lt; You & gt; .
& lt; I & gt; .
& lt; It & gt; D/files/15 & lt;/it & gt;
& lt;/c>
  •  Tags:  
  • C#
  • Related