Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

[Help]merging XML files

$
0
0
Hello,

I have the following problem when creating XML file. A user gets predefined XML file from some application that generates it. Then the same user creates part of XML file

that is generated from database. Now i have to insert that partial XML file into that pre-generated XML file on a specific location. IF i do it by hand i have to find line <Att08> that line is followed by </Att08> (line position of those 2 lines are random ... we can never tell where in XML sxactly they are nut why are always together within a file) now i have to repace those two lines with content of that generated XML file i get from database.

I have made a forms application that does all that but without automatic insert into that pre-generated XML file. Now to automate that i would have to create a script that will

take parameters:

   - name of a file we are inserting into

   - name of a file that we take to insert into pregenerated file

   - the tags <Att08></Att08> can be hard coded since they will never change and we always have to replace them.

  
So now to the XML examples:

this is a pre-generated XML file ( its only an example file and not an actual  XML because actual XML is to big to upload it here ):
<Targets AGENT_TOKEN="fbb03f77162ce70f15122343dd6b16eb8de29b6c">
<Target TYPE="oracle_emd" NAME="localhost:3938"/>
<Target TYPE="host" NAME="localhost"/>
<Target TYPE="oracle_database" NAME="word">
<Property NAME="MachineName" VALUE="localhost"/>
<Property NAME="Port" VALUE="1521"/>
<Property NAME="SID" VALUE="word"/>
<Property NAME="OracleHome" VALUE="c:\app\product\11.2.0\dbhome_2"/>
<Property NAME="UserName" VALUE="821212d" ENCRYPTED="TRUE"/>
<Property NAME="password" VALUE="061b022" ENCRYPTED="TRUE"/>
</Target>
<Target TYPE="oracle_listener" NAME="LISTENER_localhost">
<Property NAME="Machine" VALUE="localhost"/>
<Property NAME="LsnrName" VALUE="LISTENER"/>
<Property NAME="Port" VALUE="1521"/>
<Property NAME="OracleHome" VALUE="c:\app\product\11.2.0\dbhome_2"/>
<Property NAME="ListenerOraDir" VALUE="c:\app\product\11.2.0\dbhome_2\network\admin"/>
</Target>
<Att08>
</Att08>
</Targets>


And this is user-generated XML file (again not the actua one but just so you get an idea what i have to do):
<Att08>
<Property NAME="Inserted text 1" VALUE="11"/>
<Property NAME="Inserted text 2" VALUE="11"/>
<Property NAME="Inserted text 3" VALUE="11"/>
<Property NAME="Inserted text 4" VALUE="11"/>
</Att08>


Now the output should look like this:
<Targets AGENT_TOKEN="fbb03f77162ce70f15122343dd6b16eb8de29b6c">
<Target TYPE="oracle_emd" NAME="localhost:3938"/>
<Target TYPE="host" NAME="localhost"/>
<Target TYPE="oracle_database" NAME="word">
<Property NAME="MachineName" VALUE="localhost"/>
<Property NAME="Port" VALUE="1521"/>
<Property NAME="SID" VALUE="word"/>
<Property NAME="OracleHome" VALUE="c:\app\product\11.2.0\dbhome_2"/>
<Property NAME="UserName" VALUE="821212d" ENCRYPTED="TRUE"/>
<Property NAME="password" VALUE="061b022" ENCRYPTED="TRUE"/>
</Target>
<Target TYPE="oracle_listener" NAME="LISTENER_localhost">
<Property NAME="Machine" VALUE="localhost"/>
<Property NAME="LsnrName" VALUE="LISTENER"/>
<Property NAME="Port" VALUE="1521"/>
<Property NAME="OracleHome" VALUE="c:\app\product\11.2.0\dbhome_2"/>
<Property NAME="ListenerOraDir" VALUE="c:\app\product\11.2.0\dbhome_2\network\admin"/>
</Target>
<Att08>
<Property NAME="Inserted text 1" VALUE="11"/>
<Property NAME="Inserted text 2" VALUE="11"/>
<Property NAME="Inserted text 3" VALUE="11"/>
<Property NAME="Inserted text 4" VALUE="11"/>
</Att08>
</Targets>


Thank you!

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>