Processing Two XML Files

Surajsub surajsub at netscape.net
Wed Feb 12 01:16:30 EST 2003


Hi,
I am pretty much new to the xml world.I was wondering if there is a
way to combine two xml files one which functions as a template and one
which contains the values that is to be fed to the template to build a
set of property files.
Say file a is the template.xml that contains the following xml
structure
<buildconfig>
<zone>
		<filetogenerate name="API">
			<location>/usr/WebLogic/waxmagic.ear/wax.war/WEB-INF/classes/Environment.properties</location>
			<logger>waxlogger</logger>
			<JobsURL>/wax/sgi/jobs</JobsURL>
		        <jobServer>uno.1.com</jobServer>
                        .........
                        .........
                </filetogenerate>
</zone>
</buildconfig>

Then i have the zonebased.xml file which contains the property values
for the above file relevant to its zone
<zone name="workzone">
               <filetogenerate name="API">
                  <location>/usr/WebLogic/internal/waxmagic.ear/API.properties</location>
<JobsURL>/wax/sgi2/jobs</JobsURL>
<jobServer>uno.2.com</jobServer>
</filetogenerate>
</zone>

<zone name="jobszone">
<filetogenerate name="API">
<location>/usr/WebLogic/jobs/waxmagic.ear/API.properties</location>
<logger>jobslogger</logger>
<jobServer>uno2.it.com</jobServer>
</filetogenerate>
</zone>
So the end result is if we run a program that is capable of doing this
then we shud end up getting a file API.properties for the workzone in
the /usr/WebLogic/internal/waxmagic.ear/ directory that contains

logger=waxlogger --- this came from the template.xml
JobsURL=/was/sgi2/jobs --this came from the zonebased.xml
jobServer=uno.2.com ---this came from the zonebased.xml         

and a API.properties in the /usr/WebLogic/jobs/waxmagic.ear directory
for the jobszone that contains
logger=jobslogger
JobsURL=/wax/sgi/jobs
jobServer=uno2.it.com


============
Whew..that was tough..but would appreciate thots suggestions..

Thanks
Ztapori




More information about the Python-list mailing list