Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to parse xml string having deep structures using python
    text
    copied!<p>A similar question is asked here (<a href="https://stackoverflow.com/questions/7939954/python-xml-parsing">Python XML Parsing</a>) but I could not reach to the content I am interested in. </p> <p>I need to extract all the information that is enclosed between the tag <code>patent-classification</code> if the <code>classification-scheme</code> tag value is <code>CPC</code>. There are multiple such element and are enclosed inside <code>patent-classifications</code> tag. </p> <p>In the example given below, there are three such values: <code>C 07 K 16 22 I</code> , <code>A 61 K 2039 505 A</code> and <code>C 07 K 2317 21 A</code> </p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;?xml-stylesheet type="text/xsl" href="/3.0/style/exchange.xsl"?&gt; &lt;ops:world-patent-data xmlns="http://www.epo.org/exchange" xmlns:ops="http://ops.epo.org" xmlns:xlink="http://www.w3.org/1999/xlink"&gt; &lt;ops:meta name="elapsed-time" value="21"/&gt; &lt;exchange-documents&gt; &lt;exchange-document system="ops.epo.org" family-id="39103486" country="US" doc-number="2009234106" kind="A1"&gt; &lt;bibliographic-data&gt; &lt;publication-reference&gt; &lt;document-id document-id-type="docdb"&gt; &lt;country&gt;US&lt;/country&gt; &lt;doc-number&gt;2009234106&lt;/doc-number&gt; &lt;kind&gt;A1&lt;/kind&gt; &lt;date&gt;20090917&lt;/date&gt; &lt;/document-id&gt; &lt;document-id document-id-type="epodoc"&gt; &lt;doc-number&gt;US2009234106&lt;/doc-number&gt; &lt;date&gt;20090917&lt;/date&gt; &lt;/document-id&gt; &lt;/publication-reference&gt; &lt;classifications-ipcr&gt; &lt;classification-ipcr sequence="1"&gt; &lt;text&gt;C07K 16/ 44 A I &lt;/text&gt; &lt;/classification-ipcr&gt; &lt;/classifications-ipcr&gt; &lt;patent-classifications&gt; &lt;patent-classification sequence="1"&gt; &lt;classification-scheme office="" scheme="CPC"/&gt; &lt;section&gt;C&lt;/section&gt; &lt;class&gt;07&lt;/class&gt; &lt;subclass&gt;K&lt;/subclass&gt; &lt;main-group&gt;16&lt;/main-group&gt; &lt;subgroup&gt;22&lt;/subgroup&gt; &lt;classification-value&gt;I&lt;/classification-value&gt; &lt;/patent-classification&gt; &lt;patent-classification sequence="2"&gt; &lt;classification-scheme office="" scheme="CPC"/&gt; &lt;section&gt;A&lt;/section&gt; &lt;class&gt;61&lt;/class&gt; &lt;subclass&gt;K&lt;/subclass&gt; &lt;main-group&gt;2039&lt;/main-group&gt; &lt;subgroup&gt;505&lt;/subgroup&gt; &lt;classification-value&gt;A&lt;/classification-value&gt; &lt;/patent-classification&gt; &lt;patent-classification sequence="7"&gt; &lt;classification-scheme office="" scheme="CPC"/&gt; &lt;section&gt;C&lt;/section&gt; &lt;class&gt;07&lt;/class&gt; &lt;subclass&gt;K&lt;/subclass&gt; &lt;main-group&gt;2317&lt;/main-group&gt; &lt;subgroup&gt;92&lt;/subgroup&gt; &lt;classification-value&gt;A&lt;/classification-value&gt; &lt;/patent-classification&gt; &lt;patent-classification sequence="1"&gt; &lt;classification-scheme office="US" scheme="UC"/&gt; &lt;classification-symbol&gt;530/387.9&lt;/classification-symbol&gt; &lt;/patent-classification&gt; &lt;/patent-classifications&gt; &lt;/bibliographic-data&gt; &lt;/exchange-document&gt; &lt;/exchange-documents&gt; &lt;/ops:world-patent-data&gt; </code></pre>
 

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