I am programming a webservice that queries different databases for prices. The web service writes a new
node into the XML
page that is given back when calling http://service.com/xml.php?search=carpet
as soon as it has results from the database. Unfortunately the queries sent to the various databases take extremely long (up to 30 seconds total). Obviously I dont want the user to wait for 30 seconds, then give back the XML and build a table with this data; I want it to dynamically load.
Let's assume a user searches for "Carpet", the databases will give back multiple products such as "Red Carpet" and "Yellow Carpet". "Red Carpet" has two Distributors that are dynamically loaded into the table of "Red Carpet". "Yellow Carpet" only has one distributor.
I need a price comparison Table like the one shown in the below picture that dynamically adds a new table if a new article is given back and that adds a new line to the table if a new distributor is found for a product.
Do you have suggestions on how to accomplish this? How do I receive only the data that has changed from my xml.php?
Price Comparison Table Structure
XML Data
<?xml version="1.0" encoding="UTF-8"?>
<Results>
<!--Given back within 5 seconds-->
<Result>
<ArticleNumber>Red Carpet</ArticleNumber>
<Manufacturer>Big Carpet Inc</Manufacturer>
<Distributor>Amazonas</Distributor>
<Prices>
<Pricebreak>
<Quantity>1</Quantity>
<Price>$ 1.20</Price>
</Pricebreak>
<Pricebreak>
<Quantity>10</Quantity>
<Price>$ 1.00</Price>
</Pricebreak>
<Pricebreak>
<Quantity>100</Quantity>
<Price>$ 0.50</Price>
</Pricebreak>
</Prices>
</Result>
<!--Given back within another 10 seconds-->
<Result>
<ArticleNumber>Red Carpet</ArticleNumber>
<Manufacturer>Big Carpet Inc</Manufacturer>
<Distributor>Veritas</Distributor>
<Prices>
<Pricebreak>
<Quantity>1</Quantity>
<Price>$ 0.90</Price>
</Pricebreak>
<Pricebreak>
<Quantity>5</Quantity>
<Price>$ 0.70</Price>
</Pricebreak>
</Prices>
</Result>
<!--Given back within another 5 seconds-->
<Result>
<ArticleNumber>Yellow Carpet</ArticleNumber>
<Manufacturer>Smallrug Corporation</Manufacturer>
<Distributor>Veritas</Distributor>
<Prices>
<Pricebreak>
<Quantity>1</Quantity>
<Price>$ 3.90</Price>
</Pricebreak>
<Pricebreak>
<Quantity>10</Quantity>
<Price>$ 2.70</Price>
</Pricebreak>
</Prices>
</Result>
</Results>