Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

StackOverflow Point

StackOverflow Point Navigation

  • Web Stories
  • Badges
  • Tags
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Web Stories
  • Badges
  • Tags
Home/ Questions/Q 1752
Alex Hales
  • 0
Alex HalesTeacher
Asked: May 31, 20222022-05-31T01:28:36+00:00 2022-05-31T01:28:36+00:00

Parsing a nested XML file

  • 0

[ad_1]

I’m trying to parse this XML:

<dict>
<entry sk="maam: :5" eid="maam_e">
<indexer>
<seo>ma’am</seo>
<browse>
ma’am
<pos>noun</pos>
</browse>
<autocompletes>
<autocomp>ma’am</autocomp>
</autocompletes>
<indexing>
<arl type="headword">
<index>ma’am</index>
<display>
ma’am
<pos>noun</pos>
</display>
</arl>
</indexing>
</indexer>
<top-g eid="maam_topg_1">
<webtop>
<headword eid="maam_h_1">ma’am</headword>
<pos>noun</pos>
<pron-gs>
<phons_br geo="br" wd="ma'am">
<a class="uk_spkr.png">
<audio name="/m/ma/ma_/ma_am#1_gb_1" geo="br"/>
</a>
<phon>/mæm/</phon>
<pnc class="sep">,</pnc>
<a class="uk_spkr.png">
<audio name="/m/ma/ma_/ma_am#1_gb_2" geo="br"/>
</a>
<phon>/mɑːm/</phon>
</phons_br>
<phons_n_am geo="n_am" wd="ma'am">
<a class="us_spkr.png">
<audio name="/m/ma/ma_/ma_am#1_us_1" geo="n_am"/>
</a>
<phon>/mæm/</phon>
</phons_n_am>
</pron-gs>
</webtop>
<grammar>[singular]</grammar>
</top-g>
<sn-gs class="senses_multiple">
<sn-g sensenum="1" eid="maam_sng_1">
<sensetop>
<labels>(North American English)</labels>
</sensetop>
<sensebody>
<def>used as a polite way of addressing a woman</def>
<ul class="examples">
<li>
‘Can I help you, ma'am?’
<audio name="/_/_m/_ma/_ma_am#_gbs_1" geo="br"/>
<audio name="/_/_m/_ma/_ma_am#_uss_1" geo="n_am"/>
</li>
</ul>
<xr-gs xt="cp">
<pnc class="prefix">compare</pnc>
<xr-g href="sir_e" bord="n">
<xh>sir</xh>
</xr-g>
</xr-gs>
</sensebody>
</sn-g>
<sn-g sensenum="2" eid="maam_sng_2">
<sensetop>
<labels>(British English)</labels>
</sensetop>
<sensebody>
<def>used when addressing the Queen or senior women officers in the police or army</def>
</sensebody>
</sn-g>
<xr-gs xt="see">
<pnc class="prefix">see also</pnc>
<xr-g href="madam_e" bord="n">
<xh>madam</xh>
</xr-g>
</xr-gs>
<details id="maam_unbox_1" unbox="wordorigin" eid="maam_unbox_1">
<summary>Word Origin</summary>
<body>
<p>
mid 17th cent.: contraction of
<eb>madam</eb>
.
</p>
</body>
</details>
</sn-gs>
</entry>

</dict>

Basically, I have a dictionary saved in XML format. This is just a single entry.
I want to grab what is inside dict -> entry -> indexed -> SEO (at the very beginning of the code) and store it in a list, but I’m having a really hard time to parse this XML document.

I tried using etree but I’m still a noob when it comes to parsing.

Thanks for the help!

[ad_2]

  • 0 0 Answers
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report
Leave an answer

Leave an answer
Cancel reply

Browse

Sidebar

Ask A Question

Related Questions

  • xcode - Can you build dynamic libraries for iOS and ...

    • 0 Answers
  • bash - How to check if a process id (PID) ...

    • 4997 Answers
  • database - Oracle: Changing VARCHAR2 column to CLOB

    • 1084 Answers
  • What's the difference between HEAD, working tree and index, in ...

    • 1028 Answers
  • Amazon EC2 Free tier - how many instances can I ...

    • 0 Answers

Stats

  • Questions : 43k

Subscribe

Login

Forgot Password?

Footer

Follow

© 2022 Stackoverflow Point. All Rights Reserved.

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.