| |

VerySource

 Forgot password?
 Register
Search
View: 843|Reply: 5

A small problem with the config file.

[Copy link]

2

Threads

6

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-1-7 13:10:01
| Show all posts |Read mode
I would like to ask if reading a config file (defined by himself, the content is in a standard XML format), can he directly read and write it as an XML file? Regardless of its extension
config? thanks
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-1-7 17:00:01
| Show all posts
It depends on what config file, if it is web.config, it is xml itself. But web.config does not need to parse and read it by itself.
Reply

Use magic Report

2

Threads

6

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

 Author| Post time: 2020-1-7 19:00:01
| Show all posts
Not web.config, but a config file created by yourself, such as the file name aa.config
content:
<? xml version = "1.0" encoding = "utf-8"?>
<configuration>
<PrjManagePrimaryTable>
<ArchiveTables>
<TableName>
OABCK
</ TableName>
<CreatTableSql>
create table {0} ...... </ CreatTableSql>
</ ArchiveTables>
</ PrjManagePrimaryTable>
</ configuration>
I want to get the value of each node! How to call it? Thank you.
Reply

Use magic Report

1

Threads

18

Posts

14.00

Credits

Newbie

Rank: 1

Credits
14.00

 China

Post time: 2020-1-9 09:00:02
| Show all posts
XmlTextReader tr = new XmlTextReader (fileName);
while (! tr.EOF)
{
if (tr.MoveToContent () == XmlNodeType.Element)
LoadList (tr);
else
tr.Read ();
}
Reply

Use magic Report

0

Threads

4

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-1-13 11:45:01
| Show all posts
XmlDocument doc = new XmlDocument ();
ArrayList n = new ArrayList ();
doc.Load (Server.MapPath ("p.xml"));
XmlNode r = doc.DocumentElement;
foreach (XmlNode nn in r.ChildNodes)
 n.Add (nn.FirstChild.Value);
Reply

Use magic Report

0

Threads

23

Posts

20.00

Credits

Newbie

Rank: 1

Credits
20.00

 China

Post time: 2020-1-13 15:54:01
| Show all posts
Extension does not affect
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list