Learn how to a build a cloud-first strategyRegister Now


Spry XML dataset does not load

Posted on 2009-12-27
Medium Priority
Last Modified: 2012-06-27
I am using the Spry.Data.PagedView class to control the paging of data in a data set.  The data set I am using is XML which is generated dynamically using the PHP file shown below.  Normally, this dataset returns about 10,000 rows.  This is the first time I am trying to use such a large data set in a Spry.Data.PagedView and it does not seem to load.  If I artificially limit the data set to less than about 1,000 records it works.  As soon as the data set gets too large, the paged view will not load.

Are there limitations on how many records I can use in a Spry.Data.PagedView class?  If so, how can I work around this?  Is there a way that I can pass a variable into the PHP file so that it filters for the required records at runtime?

Any ideas appreciated.  

header("Content-type: text/xml"); 

$host = "localhost"; 
$user = "root"; 
$pass = "root"; 
$database = "mydatabase"; 

$linkID = mysql_connect($host, $user, $pass) or die("Could not connect to host."); 
mysql_select_db($database, $linkID) or die("Could not find database."); 

$query = "SELECT * FROM tblproperties WHERE P_ContactID>9000;";

$resultID = mysql_query($query, $linkID) or die("Data not found."); 

$xml_output = "<?xml version=\"1.0\"?>\n"; 
echo $xml_output."<optc>\n"; 
while ($line = mysql_fetch_assoc($resultID) ) {
  echo "<record>\n";
  foreach($line as $key=>$value)
  	  echo "  <$key>". htmlspecialchars($value) . "</$key>\n";	
  echo "</record>\n";
echo '</optc>'; 

Open in new window

Question by:DanielAttard
  • 3
  • 2
LVL 70

Accepted Solution

Jason C. Levine earned 2000 total points
ID: 26129269
Hi Daniel,

There should be no real limit on how many records come back. The only things I can think of are:

1. The script is timing out before it can return all of the records
2. There is some text in the XML data that breaks the file and causes the browsers to choke.  

I would lean towards #2 at this point. You should output your XML data as a separate file and run it through an XML validator to see if there are any errors.

Author Comment

ID: 26129464
Thanks for the input Jason.  I'm beginning to realize that even though it might be technically possible to load the entire XML file, this might not be the best solution for what I am trying to do since the XML file is 8MB in size.  This would mean that every time the page loads, it would have to load 8MB of data.  Obviously, that's not a good solution.

Is there some other way that I can dynamically filter the XML file at runtime?  How can I pass a variable that will filter the XML data?  
LVL 70

Expert Comment

by:Jason C. Levine
ID: 26129648
>> since the XML file is 8MB in size

Ouch.  I revert to my #1, then.  The PHP script is probably timing out on you.  

>> I can dynamically filter the XML file at runtime

Easier to filter at the PHP/MySQL level or is that not an option for you?

Author Comment

ID: 26159536
Hi Jason - How can I filter at the PHP/MySQL level?  Can I do this dynamically so that it happens at runtime?
LVL 70

Expert Comment

by:Jason C. Levine
ID: 26159919
Yes you can filter the SQL query based on any input from the site (form post, URL variable, cookies value, session value). This occurs as the query is executed so it is runtime by default.

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question