If you do choose to process a possibly too large XML document, I recommend using DOM to process the document by a pre-visit depth-first traversal appending and create a new xml document by appending the first 30 elements encountered (should this be what you mean by "30 lines of data"). Of course, what you actually need to do is dependent on what you wish to achieve. Your requirements might mean that you perform a pre-visit breadth first traversal.
If you generate the document from other sources, process that data in whatever way you see fit, but stop as soon as you have created 30 elements.
Johanafm - You have hit the nail on the head. I'm not to good with PHP and XML, but working on it. I really meant keeping exactly the same structure of the of the data recieved and creating a new file (data.XML) keeping the first 30 elements.
It is not a true XML file, but is in a structure that is easy for my flash website to read.
Here's and example of the file being recieved:
<?xml version="1.0" encoding="iso-8859-1"?>
<items>
<item title="Title1" description="Description1" url="http://www.blahblahblah.com"/>
<item title="Title2" description="Description2" url="http://www.blahblahblah.com"/>
<item title="Title3" description="Description3" url="http://www.blahblahblah.com"/>
<item title="Title4" description="Description4" url="http://www.blahblahblah.com"/>
<item title="Title5" description="Description5" url="http://www.blahblahblah.com"/>
</items>
[B]And so on for a hundred times[/B]
But I only require the first 30 elements, but keep the same structure. It looks like its possible acording to you and halojoy. I just need some extra guidance on what the best way of acomplishing this.
So the final product looks like this:
<?xml version="1.0" encoding="iso-8859-1"?>
<items>
<item title="Title1" description="Description1" url="http://www.blahblahblah.com"/>
<item title="Title2" description="Description2" url="http://www.blahblahblah.com"/>
<item title="Title3" description="Description3" url="http://www.blahblahblah.com"/>
<item title="Title4" description="Description4" url="http://www.blahblahblah.com"/>
<item title="Title5" description="Description5" url="http://www.blahblahblah.com"/>
</items>
[B]And so on for a maximum thirty times[/B]
And possibly a small example. :rolleyes:
So do you recommend reading up on DOM and find out about "pre-visit breadth first traversal"?
Sounds a mouthful and complicated or is there an easier or better way?