Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Read file size from xml dynamically

Status
Not open for further replies.

EkramulHuq

Programmer
Jan 1, 2002
3
0
0
JP
Hello,

I want to read file size from xml of a file. How can I do it?
For example:

<file>
<name>a.txt</name>
<path> \\srv_name\folder </path>
<size> &filesize; bytes </size>
</file>

the "filesize" should have size of a file from a specified path. How can i read the file size at runtime from XML??

* can I use Perl in XML to do it?? if yes, how?

Regards,
EH
 
>How can i read the file size at runtime [blue]from[/blue] XML??
>can I use Perl [blue]in[/blue] XML to do it??
I smell something I cannot answer after you explain in further detail. What is at runtime from XML or use Perl in XML?

If you bring up Perl, can I suppose you're well versed with it? Maybe this can bring you some reminiscent?
[tt]
use XML::Simple;
$xml=new XML::Simple;
$doc=$xml->XMLin("filenamehere.xml");
print $doc->{size};[/tt]
 
Hi,
Thanks for response.
Can I call this perl code from XML file?? If yes, how?
my problem is like this, xml file should have the size of a file. I can not use hard coded data because the file size is changing. i should read the file size from xml. Any solutions? Any type of solution is welcome.

BR,
EH
 
EH,

You seem to be under the mistaken impression that XML does things. It doesn't. It's just data.

You can't call Perl code from an XML file (because XML doesn't do anything.) You can use Perl to read and manipulate XML data.

Does that help?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top