XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
RE: [xml-dev] ANN: the first million prime numbers in XML format

Hi Roger,

Interesting thread, with lots of opportunities ;-).  Unfortunately, no luck with the lottery :-<

Petite Abeille wrote:
> Roger Costello wrote:
> > So I created two XML documents, collectively containing the 
> first million prime numbers.
...
> Be patient. They are large files (10 MB and 11 MB, respectively)
> 
> Nice… but… XML?!?
> 
> <prime>189149</prime>?!? Seriously?!?
> 
> Wouldn't a simple text file be more than sufficient?!?
> 
> E.g.: 
> 
> http://www.mathsisfun.com/numbers/prime-number-lists.html
> 
> If you only have a hammer...

> David Lee wrote:
> > I personally don't see anything wrong with putting lists of 
> numbers in XML format.
> 
> Fair enough… I suspect though this is going to turn into the 
> poster boy of all what's wrong with XML… but as you said, to 
> each his own :)) 


C:\>curl http://www.xfront.com/second-500000-primes.xml > second-500000-primes.xml
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
 93 10.8M   93 10.1M    0     0  32034      0  0:05:53  0:05:30  0:00:23 50808

phew.  *That* was painful.

Why not create a "web service" which calculates the "next" page of prime numbers?
Then, you could use content negotiation to specify the format (xml, json, text, html, other), the language (en, fr, other),
the compression (gzip, other) and if you used a hypermedia format, say "application/vnd.xfront.com.prime-numbers", you could use REST to continue 
retrieving prime numbers forever, if you wanted?

I suggest interactions might look like:

GET http://www.xfront.com/numbers/prime?last=7368743 HTTP/1.1
User-Agent: Mozilla/5.0 (Windows NT 6.0) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.47 Safari/536.11
Accept: application/xml;q=0.9,*/*;q=0.8
Accept-Encoding: gzip,deflate
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3

HTTP/1.1 200 OK
Date: Tue, 10 Jul 2012 20:22:59 GMT
Server: Apache
Connection: Keep-Alive
Content-Type: application/vnd.xfront.com.prime-numbers+xml; charset=UTF-8

<?xml version="1.0" encoding="UTF-8"?>
<prime-numbers>
  <link rélation="next" réfh="http://www.xfront.com/numbers/prime?last="15485863"; genremime="application/vnd.xfront.com.prime-numbers" langueh="en"/>
  <link rélation="next" réfh="http://www.xfront.com/numbers/prime?last="15485863"; genremime="application/vnd.xfront.com.prime-numbers+json" langueh="en"/>
  <link rélation="next" réfh="http://www.xfront.com/numbers/prime?last="15485863"; genremime="text/html" langueh="en"/>
  <!-- if you prefer, and understand the mime type, use text. Is there just a CR, a CRLF or only a LF, or nothing(?) separating those numbers -->
  <link rélation="prochaine" réfh="http://www.xfront.com/numbers/prime?last="15485863"; genremime="text/plain"/>
  <prime>7368791</prime>
    ...
  <prime>15485863</prime>
</prime-numbers>

GET http://www.xfront.com/numbers/prime?last=15485863

etc.

Maybe you should cut down the size of the pages a bit though.  Your thoughts?

Regards,
Peter



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS