Accessing environmet variable in xml file


 
Thread Tools Search this Thread
Top Forums Programming Accessing environmet variable in xml file
# 1  
Old 03-12-2009
Accessing environmet variable in xml file

Hi I have certain environmenet variables defined in .profile:

export DBNAME="mydb"
export DBHOST="devbox.us.abc.com"
export DBPORT="1111"
export PASSWORD="mypwd"
export MMUSER="myid"


I also have an xml file defined like:
<CONFIG>
<DEFAULTS operator="oraread">
<PROPERTY name="hostname" value="devbox.us.abc.com"/>
<PROPERTY name="port" value="1111"/>
<PROPERTY name="dbname" value="mydb"/>
<PROPERTY name="connectstring" value="myid/mypwd"/>
</DEFAULTS>
</CONFIG>

This xml file is passed external systems for certain operations.
Now is it possible to access these environment variable in the xml file.
I do not want to update the xml file as this is causing a security voilation.
So in essence I want to access these env variables in the xml structure. I donot want to ever update this xml file. Is this possible?

Thanks,
Neha
# 2  
Old 03-13-2009
State your question clearly...as of now it is hard to understand what you're trying to do.
# 3  
Old 03-15-2009
Yes, it is possible - but the program which uses the XML configuration file needs to be modified to check if the corresponding environmental variable is set and, if so, use that value rather than the value from the configuration file.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Insert value of env variable in xml file

Hello, I have the following variables set in my env echo $MY_XSD_FILE /home/jak/sample.xsd echo $MY_INTERVAL_VALUE 4 I want to insert them between the xml tags in my xml file cat sample.xml ::::::::::::::: ::::::::::::::: <property name="FILE"></property> :::::::::::::::::::::::... (2 Replies)
Discussion started by: jakSun8
2 Replies

2. Shell Programming and Scripting

How to parse xml file in variable-string?

In the wake of the post: how-parse-following-xml-file Thank you for the very useful chakrapani response 302355585-post4 ! A close question. How to pass a file to xmllint in variable? For example, let it be: NEARLY_FILE='<?xml version="1.0" encoding="iso-8859-1"?><html><set label="09/07/29"... (0 Replies)
Discussion started by: OleM2k
0 Replies

3. Shell Programming and Scripting

wish to use shell variable in xml file, is it possible?

greetings, i have an executable that reads its config from an xml file. this executable needs to be started as the current user. there is a line in the xml file that contains the following: <option name="USER_ID" value="myuserid"/>the current value is an actual user id (mine) as it was... (3 Replies)
Discussion started by: crimso
3 Replies

4. Programming

problem with accessing online XML file

Hi everyone, I am trying to access an online XML file, for example: <a href="http://www.rgraph.net/sample.xml" target="_blank">http://www.rgraph.net/sample.xml using HTML. <html> <body> <script type="text/javascript"> if (window.XMLHttpRequest) {// code for IE7+, Firefox,... (1 Reply)
Discussion started by: Xperia124
1 Replies

5. Shell Programming and Scripting

Trying to pull a variable out of an xml file...

Hello. I'm new to *ix and am trying to pull a variable or two from an xml document. The document is in the format: <name>7_3(A).mov</name> <description>Some description from a file</description> <updatename>7_3_A.mov</updatename> <updatepath>Dailies Released</updatepath> ... (3 Replies)
Discussion started by: Renfield
3 Replies

6. Shell Programming and Scripting

Accessing local variable

Hi, Would like to know the purpose and accessing of local variable as in below code snippet: a=123 ( a=321; ) echo "a = $a" #This will print 123 How to access local a variable which is assigned with value 321 ?. .. (3 Replies)
Discussion started by: IND123
3 Replies

7. Shell Programming and Scripting

parsing data from xml file is failing can't open variable

Created a korn shell script, everything is is working except this section, the variable $SYSINFO is being set, but the NASIP & NASDEV are failing, it appears to be treating the config.xml file config directory and xml as the file. Need a second set of eyes to tell me where I am messing up. #... (3 Replies)
Discussion started by: juanb25
3 Replies

8. Shell Programming and Scripting

Accessing a variable from another file

HI all, How can i access a variable that is defined in another file as: $$Name= "abhinav; in my script. The catch is that it has 2 $s behind it... Thnaks ---------- Post updated at 10:36 AM ---------- Previous update was at 10:29 AM ---------- the file from which i have to... (0 Replies)
Discussion started by: abhinav192
0 Replies

9. Shell Programming and Scripting

Grep to return a code from accessing variable file name

All I want to do is find out if the string 'NO' is in a file by checking for a return code of 0 if there is a match. The grep works fine on the command line directly naming the file but I am obviously not using the correct syntax within the shell script as I consistently get the error message ... (5 Replies)
Discussion started by: SusanDAC
5 Replies

10. UNIX for Dummies Questions & Answers

accessing shell script variable in file

Hi, I have a shell script in which there is a file conn_$temp where $temp has the pid of the shell script. in this shell script i have an embedded awk script that must read the file while ((getline < "conn_$temp") > 0) However due to the "$temp" in the file name, the awk script is... (6 Replies)
Discussion started by: HIMANI
6 Replies
Login or Register to Ask a Question