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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Where to find large xml file

Status
Not open for further replies.

angoras

Programmer
Joined
Feb 21, 2009
Messages
2
Location
RO
Hello, i am looking for a relatively large (around 100mb) sample xml file which contains data like:

<article>
<title>Title</title>
<body>Body</body>
</article>

Can anyone help ?
Thanks.
 
Or something close to that format.
 
[0] You could create one for yourself, if it is just for the purpose to testing performance.

[1] This is how you can do with php script, using XMLWriter for performance.
[tt]
<?php
[green]//your specs
$sfile="large.xml"; //the file name
$nnodecreation=1000; //1000000; number of article node to be created
$nflushsize=1000; //some large but not too large number trade-off io-efficiency and memory footprint[/green]

$xw=new XMLWriter();
$xw->openMemory();
$xw->setIndent(true); //use default: one (1) space only

$xw->startDocument('1.0','UTF-8');
$xw->startElement('root'); //the wrapping container
file_put_contents($sfile,$xw->flush(true));

for ($i=0; $i<$nnodecreation; $i++) {
$xw->startElement('article');
$xw->writeElement('title','sample-title-'.$i);
$xw->writeElement('body','sample-body-'.$i);
$xw->endElement();
if ($i % $nflushsize==0) {
file_put_contents($sfile,$xw->flush(true),FILE_APPEND);
}
}

$xw->endElement();
file_put_contents($sfile,$xw->flush(true),FILE_APPEND);

/*
100 -> 8.5KB //100 article blocks about 8.51 KBytes
1,000 -> 85.6KB
100,000 -> 8.75MB
1,000,000 -> 89.4 MB
*/
?>
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top