472,967 Members | 1,962 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,967 software developers and data experts.

How do you read in an environment variable in an XML file? . . .

that was set up for and/or by this user in the OS.

Say, you set WEB_DIR as an environment variable pointing to certain
folder or root directory

Could you go like this

<?xml version='1.0' encoding='utf-8'?>
<XMLExample Att1="69" Att2=$WEB_DIR"rest_of_it">

.. . .

</XMLExample>

for attributes or values?

And when a program parses the XML doc it should pick the current env.
var. value.

I think of using it for tomcat's configuration files which are more
XMLish than true XML ones.

There are ways to pass in parameters to the JVM when you run a java
prog., but I don't know of a way to read in an external environment
variable from the OS into an updated conf doc and use this value

How do you do something like that?
Jul 20 '05 #1
3 21334


Albretch wrote:
that was set up for and/or by this user in the OS.

Say, you set WEB_DIR as an environment variable pointing to certain
folder or root directory

Could you go like this

<?xml version='1.0' encoding='utf-8'?>
<XMLExample Att1="69" Att2=$WEB_DIR"rest_of_it">

. . .

</XMLExample>

for attributes or values?

And when a program parses the XML doc it should pick the current env.
var. value.

I think of using it for tomcat's configuration files which are more
XMLish than true XML ones.

There are ways to pass in parameters to the JVM when you run a java
prog., but I don't know of a way to read in an external environment
variable from the OS into an updated conf doc and use this value

How do you do something like that?


There is no general XML mechanism for that. XSLT 1.0 knows global
parameters defined as
<xsl:param name="paramName" />
which you can then set before you run an XSLT transformation. JAXP has a
method serParameter to set such parameters before you do a transformation.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 20 '05 #2
Albretch <lb*****@hotmail.com> wrote:
that was set up for and/or by this user in the OS.

Say, you set WEB_DIR as an environment variable pointing to certain
folder or root directory

Could you go like this

<?xml version='1.0' encoding='utf-8'?>
<XMLExample Att1="69" Att2=$WEB_DIR"rest_of_it">

. . .

</XMLExample>

for attributes or values? [...] How do you do something like that?


Yourself. AFAIK, XML parsers don't expand environemtn variables.

To get the value of an environment variable, see:
- System#getProperty(String)
- Integer#getInteger(String)
- Long#getLong(String)
- And similar methods in these classes.
--
Oscar Kind http://home.hccnet.nl/okind/
Software Developer for contact information, see website

PGP Key fingerprint: 91F3 6C72 F465 5E98 C246 61D9 2C32 8E24 097B B4E2
Jul 20 '05 #3
Martin Honnen <ma*******@yahoo.de> wrote in message news:<41***********************@newsread4.arcor-online.net>...
There is no general XML mechanism for that. XSLT 1.0 knows global
parameters defined as
<xsl:param name="paramName" />
which you can then set before you run an XSLT transformation. JAXP has a
method serParameter to set such parameters before you do a transformation.


I think that would do it in a clean way:

1._ Set up purposed/altered/parameterised xml conf files

2._ Check out TC's sources to chnage the code segments where it reads
these conf files and

3._ pass them first through an XSLT transformation that would:
3.1_ read the values in from env. vars
3.2_ inject them in the files
on the fly

4._ before these files reach TC proper . . .
Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Matthew Barnes | last post by:
I'm considering submitting a patch for Python 2.4 to allow environment variable expansion in ConfigParser files. The use cases for this should be obvious. I'd like to be able to specify something...
1
by: Shahzad Atta | last post by:
Hi there, I am using a batch file to do some zipping task. This batch file get executed on postbuild event which I set through project properties. Now when I execute the batch file from command...
2
by: shaun | last post by:
Is there anyway to access a system environment variable from within an xml document? Two applications: 1) I'd like to make an XBase declared path equal to an environment variable declared path....
28
by: Christian | last post by:
Another question from a not even newbie: In Unix you can set an environment variable with the command export PYTHONPATH but I would like to set the variable from at .py script. So my question...
2
by: Vinay | last post by:
Hi We can use Environment class to read %Temp% variable o local machine. But I want to read this variable for currently logged on used for remote machine. Is there anyway to do this using .NET? I...
6
by: yaron | last post by:
Hi, my application use environment variable, let call it FOO. how can i add the FOO environment variable to my project or my solution, so the line string foo =...
6
by: dylan.boudreau | last post by:
My configuration is Apache/2.0.59 (Unix) mod_ssl/2.0.59 OpenSSL/0.9.7d PHP/5.0.4 on Solaris 10. phpinfo() lists the location of php.ini as /usr/local/apache/conf and my php.ini file is there but...
23
by: ShaneO | last post by:
Hello, I wish to extract embedded string data from a file using a Binary Read method. The following code sample is used in VB.NET and similar code is used in VB6 - (Assume variable...
3
by: smitty1e | last post by:
Just a fun exercise to unify some of the major input methods for a script into a single dictionary. Here is the output, given a gr.conf file in the same directory with the contents stated below: ...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.