Sign in to follow this  
Followers 0
Gobinath

Read Data From Xml

6 posts in this topic

<BackupSet>

<Name>07-02-2011_12-43-34</Name>

<OSVersion>Windows7</OSVersion>

<CreationTime>07/02/2011 12:44:06</CreationTime>

<DiskSize>40.0 GB</DiskSize>

<DiskUsedSize>40.0 GB</DiskUsedSize>

<BackupType>PARTITION_BACKUP</BackupType>

<CompressionType>NO_COMPRESSION</CompressionType>

<EncryptionType>NO_ENCRYPTION</EncryptionType>

<Comment></Comment>

<MaxNoOfIncrementals>600</MaxNoOfIncrementals>

<VolumeSet>G,I</VolumeSet>

<NoOfPartitions>2</NoOfPartitions>

<Partition>

<Name>G:\</Name>

<Index></Index>

<Size>20.0 GB</Size>

<UsedSpace>1.53 GB</UsedSpace>

</Partition>

<Partition>

<Name>I:\</Name>

<Index></Index>

<Size>19.99 GB</Size>

<UsedSpace>202.13 MB</UsedSpace>

</Partition>

</BackupSet>

here i m using this xml file how to read the name (which is bold) Exactly

and store in to variable

????????????

backupsetinfo1.xml

Share this post


Link to post
Share on other sites



#include <Array.au3>

$hXML = FileOpen(@ScriptDir & "\backupsetinfo1.xml")
If $hXML = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf
$sXML = FileRead($hXML)
FileClose($hXML)
$aRet = StringRegExp($sXML, '<Name>(.*?)</Name>', 3)
_ArrayDisplay($aRet)

Share this post


Link to post
Share on other sites

This example is a little bit more tailored to the .xml file in post #1. The reg. exp. pattern excludes matches having ":" present in between "<Name>" and "</Name>".

#include <Array.au3>

Local $sXML = FileRead(@ScriptDir & "\backupsetinfo1.xml")
Local $aRet = StringRegExp($sXML, '<Name>([^:]*?)</Name>', 3)
_ArrayDisplay($aRet)

Share this post


Link to post
Share on other sites

Myself, I'd do this with Java and its XPath library which are excellent tools for this type of job.

Share this post


Link to post
Share on other sites

Thanks Guyz.............!!!!!!!!!!!!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0