-
August 11th, 2011, 02:41 PM
#1
Variables in xml
Hello,
We have these xml formatted .config files that come with all our ASP.NET programs. Well they have keys that need to be populated and I am unable to understand how to create a variable in xml and use it. The articles on variables in xml all seem to be talking about some other type of variable than I am familiar with. I am used to working in C or other programming languages.
I want to do something like
MyVariable = "SomeString"
<add key="Key1" value=MyVariable>
Anyone know how?
-
August 12th, 2011, 04:30 AM
#2
Re: Variables in xml
Xml is a markup language. You can have your tags and your attributes and your values, but you cannot have "variables" or flow control statement. You could have both them in the parser, in an xls file, in xslt, ...
That is : xml per se carries data, organized via tags, even with attributes. You could code inside several values, but is up to the parser (or to the writer to assign) to switch between these values and node names and attributes to show (or hide) them as you want
...at present time, using mainly Net 4.0, Vs 2010
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
-
August 12th, 2011, 12:22 PM
#3
Re: Variables in xml
Sorry I am lost in this. I am a network admin and I have millions of these config files, they all have these keys that need to be set to the same exact value. The value is a long complex string value and by entering the string only once it would reduce the risk for mistakes.
-
August 12th, 2011, 07:25 PM
#4
Re: Variables in xml
I am used to working in C or other programming languages.
XML files are text files. If you can find a program that will open a batch of files and edit them, it should work
-
August 13th, 2011, 12:17 AM
#5
Re: Variables in xml
If you truly have a lot of these files then it may be worth while to create a program that will do a batch edit. Should not be that hard to do.
Always use [code][/code] tags when posting code.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|