Example using XML source data from a URL ######################################## This example (``cansas.py``) shows how content can be scraped from a URL that provides XML (using the *lxml* package) and written as a reST table. This particular XML uses a namespace which we setup in the variable ``nsmap``: .. literalinclude:: cansas.py :tab-width: 4 :linenos: :language: guess The output from this code: .. code-block:: text :linenos: 10 SASentry elements in https://raw.githubusercontent.com/canSAS-org/1dwg/master/examples/cs_af1410.xml +-----------+--------------------------------------+--------------+ | entry | description | measurements | +===========+======================================+==============+ | AF1410:10 | AF1410-10 (AF1410 steel aged 10 h) | 2 | +-----------+--------------------------------------+--------------+ | AF1410:8h | AF1410-8h (AF1410 steel aged 8 h) | 2 | +-----------+--------------------------------------+--------------+ | AF1410:qu | AF1410-qu (AF1410 steel aged 0.25 h) | 2 | +-----------+--------------------------------------+--------------+ | AF1410:cc | AF1410-cc (AF1410 steel aged 100 h) | 2 | +-----------+--------------------------------------+--------------+ | AF1410:2h | AF1410-2h (AF1410 steel aged 2 h) | 2 | +-----------+--------------------------------------+--------------+ | AF1410:50 | AF1410-50 (AF1410 steel aged 50 h) | 2 | +-----------+--------------------------------------+--------------+ | AF1410:20 | AF1410-20 (AF1410 steel aged 20 h) | 1 | +-----------+--------------------------------------+--------------+ | AF1410:5h | AF1410-5h (AF1410 steel aged 5 h) | 2 | +-----------+--------------------------------------+--------------+ | AF1410:1h | AF1410-1h (AF1410 steel aged 1 h) | 2 | +-----------+--------------------------------------+--------------+ | AF1410:hf | AF1410-hf (AF1410 steel aged 0.5 h) | 2 | +-----------+--------------------------------------+--------------+ The resulting table is shown: 10 SASentry elements in http://www.cansas.org/svn/1dwg/trunk/examples/cs_af1410.xml +-----------+--------------------------------------+--------------+ | entry | description | measurements | +===========+======================================+==============+ | AF1410:10 | AF1410-10 (AF1410 steel aged 10 h) | 2 | +-----------+--------------------------------------+--------------+ | AF1410:8h | AF1410-8h (AF1410 steel aged 8 h) | 2 | +-----------+--------------------------------------+--------------+ | AF1410:qu | AF1410-qu (AF1410 steel aged 0.25 h) | 2 | +-----------+--------------------------------------+--------------+ | AF1410:cc | AF1410-cc (AF1410 steel aged 100 h) | 2 | +-----------+--------------------------------------+--------------+ | AF1410:2h | AF1410-2h (AF1410 steel aged 2 h) | 2 | +-----------+--------------------------------------+--------------+ | AF1410:50 | AF1410-50 (AF1410 steel aged 50 h) | 2 | +-----------+--------------------------------------+--------------+ | AF1410:20 | AF1410-20 (AF1410 steel aged 20 h) | 1 | +-----------+--------------------------------------+--------------+ | AF1410:5h | AF1410-5h (AF1410 steel aged 5 h) | 2 | +-----------+--------------------------------------+--------------+ | AF1410:1h | AF1410-1h (AF1410 steel aged 1 h) | 2 | +-----------+--------------------------------------+--------------+ | AF1410:hf | AF1410-hf (AF1410 steel aged 0.5 h) | 2 | +-----------+--------------------------------------+--------------+