My code is shown below. It ingests XML from here: https://www.sec.gov/Archives/edgar/data/1413909/000149315218018055/dsgt-20180930.xml.
I would like to create a dictionary from keys and values in 'xbrli:xbrl'
- i.e. create a dictionary from the keys and values shown in the second block of code below.
However, my code returns an empty dictionary. It completely skips xbrli:xbrl
and goes directly to link:schemaRef
.
import requests
import pandas as pd
import urllib.request as urllib2
import xml.etree.ElementTree as ET
from lxml import etree
def namespaces(url):
tree = ET.parse(urllib2.urlopen(url))
root = tree.getroot()
d = dict(root.attrib)
return d.keys()
I would like to create a dictionary from this:
<xbrli:xbrl
xmlns:xbrli="http://www.xbrl.org/2003/instance"
xmlns:DSGT="http://dsgtag.com/20180930"
xmlns:country="http://xbrl.sec.gov/country/2017-01-31"
xmlns:currency="http://xbrl.sec.gov/currency/2017-01-31"
xmlns:dei="http://xbrl.sec.gov/dei/2018-01-31"
xmlns:iso4217="http://www.xbrl.org/2003/iso4217"
xmlns:link="http://www.xbrl.org/2003/linkbase"
xmlns:nonnum="http://www.xbrl.org/dtr/type/non-numeric"
xmlns:num="http://www.xbrl.org/dtr/type/numeric"
xmlns:ref="http://www.xbrl.org/2006/ref"
xmlns:srt="http://fasb.org/srt/2018-01-31"
xmlns:us-gaap="http://fasb.org/us-gaap/2018-01-31"
xmlns:us-roles="http://fasb.org/us-roles/2018-01-31"
xmlns:xbrldi="http://xbrl.org/2006/xbrldi"
xmlns:xbrldt="http://xbrl.org/2005/xbrldt"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>...</xbrli:xbrl>