I need a vb-script to append an XML file. Is there any one who can help me with the script?
Hi,
As I'm not familiar with the scripting i need help on this,
Here below is the default XML file,
<OceanApplicationShell>
<ApplicationShell>
<Name>Petrel</Name>
<Version>2012 (64-bit)</Version>
<InstallPath>C:\Program Files\Schlumberger\Petrel 2012</InstallPath>
<InstalledPlugins>
<Plugin>
<Name>PowerPoint creator</Name>
<Description>Create PowerPoint presentations from Petrel's windows.</Description>
<Contact>Support Portal: http://support.slb.comEmail: customercarecenter@slb.comSupport Line: +1 866 829 0234</Contact>
<PluginTypeName>Slb.NAL.PowerPointUtility.PowerPointUtilityPlugin, Slb.NAL.PowerPointUtility, Version=2012.1.0.0, Culture=neutral, PublicKeyToken=c04a7e867bb7b019</PluginTypeName>
<ImageResourceName>Slb.NAL.PowerPointUtility.Resources.PowerPoint_ms_3.ico</ImageResourceName>
<PluginUri>http://www.support.slb.com/</PluginUri>
<PluginId>://Slb.NAL.PowerPointUtility.PowerPointUtilityPlugin/2012.1.0.0</PluginId>
<Trust PublicKeyToken="c04a7e867bb7b019">Schlumberger-NAL</Trust>
<ReleaseDate>2012-08-23</ReleaseDate>
<Author>Schlumberger</Author>
<AppVersion>2012.1.236.1</AppVersion>
<Modules>
<Module TypeName="Slb.NAL.PowerPointUtility.PowerPointUtilityModule, Slb.NAL.PowerPointUtility, Version=2012.1.0.0, Culture=neutral, PublicKeyToken=c04a7e867bb7b019">
<HintPath>c:\program files\schlumberger\petrel 2012\extensions\powerpoint creator_2012.1.0.0\slb.nal.powerpointutility.dll</HintPath>
</Module>
</Modules>
<Assemblies>
<Assembly Name="Slb.NAL.PowerPointUtility, Version=2012.1.0.0, Culture=neutral, PublicKeyToken=c04a7e867bb7b019">
<CodeBase>file:///c:/program files/schlumberger/petrel 2012/extensions/powerpoint creator_2012.1.0.0/Slb.NAL.PowerPointUtility.dll</CodeBase>
</Assembly>
</Assemblies>
<IsLegacy>False</IsLegacy>
<CodeBase>C:\Program Files\Schlumberger\Petrel 2012\Extensions\PowerPoint creator_2012.1.0.0</CodeBase>
<StartMode>Startup</StartMode>
<StartupAction>None</StartupAction>
</Plugin>
</InstalledPlugins>
<SecurityLevel Level="Sops0/Yb0qsarulNj7CKPg==" />
<trustPublishers>
<trustPublisher Name="xfv4dMKDNmcsjHfrE3GBgia0HGAmewfzCu5tT11iSkY=" PublicKeyToken="HiVP0DIztdoLw6SlhwAPHeytLcbVP0pUP2uJMAf5o9wCTshrNaSAFnr5xw08Emrb" />
<trustPublisher Name="p9vMOY7+mAtaour+dwcflkx09HWIPAP/k+m97Qz3ot1h6zvLklU7QWL+SeUe0pWi" PublicKeyToken="HiVP0DIztdoLw6SlhwAPHeytLcbVP0pUP2uJMAf5o9wCTshrNaSAFnr5xw08Emrb" />
</trustPublishers>
</ApplicationShell>
</OceanApplicationShell>.
I need script which add the below line to the existing above XML File,
<Plugin>
<Name>GeoFrame Data Connector</Name>
<Description>Transfer data between GeoFrame and Petrel. Version 3.2012.1.0
GeoFrame baseline: gf2012_14_HF_3</Description>
<Contact>https://support.slb.com/</Contact>
<PluginTypeName>Slb.GeoFrame.ImportFromGeoFrame.GFDataConnectorPlugin, Slb.GeoFrame.ImportFromGeoFrame, Version=3.2012.1.0, Culture=neutral, PublicKeyToken=2550a3567594a224</PluginTypeName>
<ImageResourceName>Slb.GeoFrame.ImportFromGeoFrame.geoframe_logo_m.bmp</ImageResourceName>
<PluginUri>http://www.ocean.slb.com/Pages/Product.aspx?category=informationmanagement&cat=Ocean&id=PGFC-B1</PluginUri>
<PluginId>://Slb.GeoFrame.ImportFromGeoFrame.ImportFromGeoFrame/3.2012.1.0</PluginId>
<Trust PublicKeyToken="2550a3567594a224">Slb-GeoFrame</Trust>
<ReleaseDate>2012-07-18</ReleaseDate>
<Author>Schlumberger</Author>
<AppVersion>2012.1</AppVersion>
<Modules>
<Module TypeName="Slb.GeoFrame.ImportFromGeoFrame.ImportFromGeoFrame, Slb.GeoFrame.ImportFromGeoFrame, Version=3.2012.1.0, Culture=neutral, PublicKeyToken=2550a3567594a224">
<HintPath>c:\program files\schlumberger\petrel 2012\extensions\geoframe data connector_3.2012.1.0\slb.geoframe.importfromgeoframe.dll</HintPath>
</Module>
</Modules>
<Assemblies>
<Assembly Name="Slb.GeoFrame.ImportFromGeoFrame, Version=3.2012.1.0, Culture=neutral, PublicKeyToken=2550a3567594a224">
<CodeBase>file:///c:/program files/schlumberger/petrel 2012/extensions/geoframe data connector_3.2012.1.0/Slb.GeoFrame.ImportFromGeoFrame.dll</CodeBase>
</Assembly>
</Assemblies>
<IsLegacy>False</IsLegacy>
<CodeBase>C:\Program Files\Schlumberger\Petrel 2012\Extensions\GeoFrame Data Connector_3.2012.1.0</CodeBase>
<StartMode>Startup</StartMode>
<StartupAction>None</StartupAction>
</Plugin>
The final XML Looks like,
<OceanApplicationShell>
<ApplicationShell>
<Name>Petrel</Name>
<Version>2012 (64-bit)</Version>
<InstallPath>C:\Program Files\Schlumberger\Petrel 2012</InstallPath>
<InstalledPlugins>
<Plugin>
<Name>PowerPoint creator</Name>
<Description>Create PowerPoint presentations from Petrel's windows.</Description>
<Contact>Support Portal: http://support.slb.comEmail: customercarecenter@slb.comSupport Line: +1 866 829 0234</Contact>
<PluginTypeName>Slb.NAL.PowerPointUtility.PowerPointUtilityPlugin, Slb.NAL.PowerPointUtility, Version=2012.1.0.0, Culture=neutral, PublicKeyToken=c04a7e867bb7b019</PluginTypeName>
<ImageResourceName>Slb.NAL.PowerPointUtility.Resources.PowerPoint_ms_3.ico</ImageResourceName>
<PluginUri>http://www.support.slb.com/</PluginUri>
<PluginId>://Slb.NAL.PowerPointUtility.PowerPointUtilityPlugin/2012.1.0.0</PluginId>
<Trust PublicKeyToken="c04a7e867bb7b019">Schlumberger-NAL</Trust>
<ReleaseDate>2012-08-23</ReleaseDate>
<Author>Schlumberger</Author>
<AppVersion>2012.1.236.1</AppVersion>
<Modules>
<Module TypeName="Slb.NAL.PowerPointUtility.PowerPointUtilityModule, Slb.NAL.PowerPointUtility, Version=2012.1.0.0, Culture=neutral, PublicKeyToken=c04a7e867bb7b019">
<HintPath>c:\program files\schlumberger\petrel 2012\extensions\powerpoint creator_2012.1.0.0\slb.nal.powerpointutility.dll</HintPath>
</Module>
</Modules>
<Assemblies>
<Assembly Name="Slb.NAL.PowerPointUtility, Version=2012.1.0.0, Culture=neutral, PublicKeyToken=c04a7e867bb7b019">
<CodeBase>file:///c:/program files/schlumberger/petrel 2012/extensions/powerpoint creator_2012.1.0.0/Slb.NAL.PowerPointUtility.dll</CodeBase>
</Assembly>
</Assemblies>
<IsLegacy>False</IsLegacy>
<CodeBase>C:\Program Files\Schlumberger\Petrel 2012\Extensions\PowerPoint creator_2012.1.0.0</CodeBase>
<StartMode>Startup</StartMode>
<StartupAction>None</StartupAction>
</Plugin>
<Plugin>
<Name>GeoFrame Data Connector</Name>
<Description>Transfer data between GeoFrame and Petrel. Version 3.2012.1.0
GeoFrame baseline: gf2012_14_HF_3</Description>
<Contact>https://support.slb.com/</Contact>
<PluginTypeName>Slb.GeoFrame.ImportFromGeoFrame.GFDataConnectorPlugin, Slb.GeoFrame.ImportFromGeoFrame, Version=3.2012.1.0, Culture=neutral, PublicKeyToken=2550a3567594a224</PluginTypeName>
<ImageResourceName>Slb.GeoFrame.ImportFromGeoFrame.geoframe_logo_m.bmp</ImageResourceName>
<PluginUri>http://www.ocean.slb.com/Pages/Product.aspx?category=informationmanagement&cat=Ocean&id=PGFC-B1</PluginUri>
<PluginId>://Slb.GeoFrame.ImportFromGeoFrame.ImportFromGeoFrame/3.2012.1.0</PluginId>
<Trust PublicKeyToken="2550a3567594a224">Slb-GeoFrame</Trust>
<ReleaseDate>2012-07-18</ReleaseDate>
<Author>Schlumberger</Author>
<AppVersion>2012.1</AppVersion>
<Modules>
<Module TypeName="Slb.GeoFrame.ImportFromGeoFrame.ImportFromGeoFrame, Slb.GeoFrame.ImportFromGeoFrame, Version=3.2012.1.0, Culture=neutral, PublicKeyToken=2550a3567594a224">
<HintPath>c:\program files\schlumberger\petrel 2012\extensions\geoframe data connector_3.2012.1.0\slb.geoframe.importfromgeoframe.dll</HintPath>
</Module>
</Modules>
<Assemblies>
<Assembly Name="Slb.GeoFrame.ImportFromGeoFrame, Version=3.2012.1.0, Culture=neutral, PublicKeyToken=2550a3567594a224">
<CodeBase>file:///c:/program files/schlumberger/petrel 2012/extensions/geoframe data connector_3.2012.1.0/Slb.GeoFrame.ImportFromGeoFrame.dll</CodeBase>
</Assembly>
</Assemblies>
<IsLegacy>False</IsLegacy>
<CodeBase>C:\Program Files\Schlumberger\Petrel 2012\Extensions\GeoFrame Data Connector_3.2012.1.0</CodeBase>
<StartMode>Startup</StartMode>
<StartupAction>None</StartupAction>
</Plugin>
</InstalledPlugins>
<SecurityLevel Level="Sops0/Yb0qsarulNj7CKPg==" />
<trustPublishers>
<trustPublisher Name="xfv4dMKDNmcsjHfrE3GBgia0HGAmewfzCu5tT11iSkY=" PublicKeyToken="HiVP0DIztdoLw6SlhwAPHeytLcbVP0pUP2uJMAf5o9wCTshrNaSAFnr5xw08Emrb" />
<trustPublisher Name="p9vMOY7+mAtaour+dwcflkx09HWIPAP/k+m97Qz3ot1h6zvLklU7QWL+SeUe0pWi" PublicKeyToken="HiVP0DIztdoLw6SlhwAPHeytLcbVP0pUP2uJMAf5o9wCTshrNaSAFnr5xw08Emrb" />
</trustPublishers>
</ApplicationShell>
</OceanApplicationShell>
Answers (2)
It only took me less than 10n seconds to find the answer in google..
http://technet.microsoft.com/en-us/magazine/2008.02.heyscriptingguy.aspx?pr=PuzzleAnswer
Comments:
-
Hi dj,
I've gone through it before posting here..
But, I'm unable to create a script for my requirement as this is the first time that i'm working with VBScript and so.
Could you please help me with the script for my requirement. Please help me as this is a bit urgent. If I know how to do it then I would have created it myself.
request you to help me with this.
Thanks in advance.. - vinodreddy10 11 years ago -
this example explains more in detail especially if u have no vbscript experience:
http://bytes.com/topic/asp-classic/answers/56019-insert-new-node-into-xml-file
read, learn, test and try :) - mattski 11 years ago -
Hello vino,
I'm afraid.. I cannot do that for the moment. You will have to deal with it yourself or wait for someone else. - dj_xest 11 years ago
Just a thought... if the final XMLs content is static: could you compile a working XML manually (as you did above) and just copy it inside your VBScript to its destination?
If you should need a hint on copying files with VBS take a look here:
http://msdn.microsoft.com/en-us/library/e1wf9e7w(v=vs.84).aspx