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 a 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

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3275650
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T19:10:05+00:00 2026-05-17T19:10:05+00:00

Environment: Windows,Python,wxpython and Element tree as xml parser. I am developing a stand alone

  • 0

Environment: Windows,Python,wxpython and Element tree as xml parser.

I am developing a stand alone where it reads the xml and creates a tree.
My application reads the xml and creates tree but when xml changes next time(when DEPTH of xml increases- i mean when two child elements are added).Application fails to read(Logic fails 🙁 )

For e.g.
I have written a logic which can read any xml which has a depth of 5.But when it reads an xml with a depth more than 5 , it fails.
Please let me know how to read xml whose depth is dynamic.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T19:10:05+00:00Added an answer on May 17, 2026 at 7:10 pm

    You should use recursive calls, something more like:

    def recurse_tree(node):
        tree = {}
        for element in node:
            name = element.get('name')
            tree[name] = recurse_tree(element)
        if tree:
            return tree
        else:
            return 'No children.'
    

    Not all of your elements had ‘name’ attributes. So you will need to adjust this to match your exact data structure.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Python 2.6 in Windows environment for my current work. But i
Working on a word occurrence count application in a Python 3.2 / Windows environment.
This is part of a python program under windows environment. I am trying to
I am interested in learning python and ruby, but I use Windows 7. Most
On Windows 7, running Python 2.7, python setup.py install installs python-money , but doesn't
How can I persistently modify the Windows environment variables from a Python script? (it's
My environment: Windows 7 64 pro, mingw32 (installed with 2012-04-26.exe installer), msys 1.0, Python
Environment: Windows Server 2008 R2 on Amazon EC2 Netbeans IDE with Glassfish started on
Environment: Windows XP, SpringSource Tool Suite 2.3.2, Roo 1.0.2.Release, Java 1.6.0_10, tc Server 6.0
Environment info: *Windows Vista *PHP 5.2.9-2 I'm working on a project. Let's say it's

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

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.