*
The moose likes XML and Related Technologies and the fly likes XML Beans..Can xml file read system variable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "XML Beans..Can xml file read system variable" Watch "XML Beans..Can xml file read system variable" New topic
Author

XML Beans..Can xml file read system variable

dimpsonu arora
Ranch Hand

Joined: Aug 13, 2003
Posts: 51
Hi,
I am using XMLBeans which is reading an xml file.
For example: Following are contents of xml file.

<Log4JPropertiesFilePath>C:/MyProj/config/log4j.properties</Log4JPropertiesFilePath>
<LogFilePath>C:/MyProj/logs/ICA_log.txt</LogFilePath>

The above kind of c:/MyProj locations are defind at many places in xml file.

Now, problem is that if the above location gets changed, I will have to make changes in the complete xml file which I don't want.

Is there any way where I can define my location "c:/MyProj" at a common place in XML Or outside XML from where XML can read it.

It is very urgent. Please help.

Thanks in advance.
Jhakda Velu
Ranch Hand

Joined: Feb 26, 2008
Posts: 166
Hi
How are you forming your XML? Can't you force the code making your XML to read it,say, from a property file and insert it at the proper tag in the XML?

Jhakda


If I become filthy rich, I'll sponsor research for painless dental treatment at Harvard Medical School. Thats why,I'm learning Java.I have 32 teeth, 22 are man made.
dimpsonu arora
Ranch Hand

Joined: Aug 13, 2003
Posts: 51
Done! Thanks.
Jhakda Velu
Ranch Hand

Joined: Feb 26, 2008
Posts: 166
Hi
What did you do,do let us know. Share the knowledge.

Jhakda
Nitesh Kant
Bartender

Joined: Feb 25, 2007
Posts: 1638

Originally posted by dimpsonu arora:

Is there any way where I can define my location "c:/MyProj" at a common place in XML Or outside XML from where XML can read it.


What is the meaning of "Xml can read it"?
XML is not an application, it is a simple file. It is like saying i will write a place holder in a Text file and the text file should read the value for the place holder from another file!
It is the application that reads an XML file and thus the application must have the intelligence as to how to understand a place holder like the path you are talking about. I can write in my Xml something like:

The application reading this will know that the actual value in between these tags will come from a system variable.


apigee, a better way to API!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: XML Beans..Can xml file read system variable