Note that there are some explanatory texts on larger screens.

plurals
  1. POGood python XML parser to work with namespace heavy documents
    primarykey
    data
    text
    <p>Python elementTree seems unusable with namespaces. What are my alternatives? BeautifulSoup is pretty rubbish with namespaces too. I don't want to strip them out.</p> <p>Examples of how a particular python library gets namespaced elements and their collections are all +1.</p> <p><strong>Edit:</strong> Could you provide code to deal with this real world use-case using your library of choice?</p> <p><strong>How would you go about getting strings 'Line Break', '2.6' and a list ['PYTHON', 'XML', 'XML-NAMESPACES']</strong></p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;zs:searchRetrieveResponse xmlns="http://unilexicon.com/vocabularies/" xmlns:zs="http://www.loc.gov/zing/srw/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:lom="http://ltsc.ieee.org/xsd/LOM"&gt; &lt;zs:records&gt; &lt;zs:record&gt; &lt;zs:recordData&gt; &lt;srw_dc:dc xmlns:srw_dc="info:srw/schema/1/dc-schema"&gt; &lt;name&gt;Line Break&lt;/name&gt; &lt;dc:title&gt;Processing XML namespaces using Python&lt;/dc:title&gt; &lt;dc:description&gt;How to get contents string from an element, how to get a collection in a list...&lt;/dc:description&gt; &lt;lom:metaMetadata&gt; &lt;lom:identifier&gt; &lt;lom:catalog&gt;Python&lt;/lom:catalog&gt; &lt;lom:entry&gt;2.6&lt;/lom:entry&gt; &lt;/lom:identifier&gt; &lt;/lom:metaMetadata&gt; &lt;lom:classification&gt; &lt;lom:taxonPath&gt; &lt;lom:taxon&gt; &lt;lom:id&gt;PYTHON&lt;/lom:id&gt; &lt;/lom:taxon&gt; &lt;/lom:taxonPath&gt; &lt;/lom:classification&gt; &lt;lom:classification&gt; &lt;lom:taxonPath&gt; &lt;lom:taxon&gt; &lt;lom:id&gt;XML&lt;/lom:id&gt; &lt;/lom:taxon&gt; &lt;/lom:taxonPath&gt; &lt;/lom:classification&gt; &lt;lom:classification&gt; &lt;lom:taxonPath&gt; &lt;lom:taxon&gt; &lt;lom:id&gt;XML-NAMESPACES&lt;/lom:id&gt; &lt;/lom:taxon&gt; &lt;/lom:taxonPath&gt; &lt;/lom:classification&gt; &lt;/srw_dc:dc&gt; &lt;/zs:recordData&gt; &lt;/zs:record&gt; &lt;!-- ... more records ... --&gt; &lt;/zs:records&gt; &lt;/zs:searchRetrieveResponse&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload