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 6004835
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:19:07+00:00 2026-05-23T01:19:07+00:00

I have an xml file that looks like this: <!DOCTYPE ROOT SYSTEM zombie.dtd> <ROOT>

  • 0

I have an xml file that looks like this:

<!DOCTYPE ROOT SYSTEM "zombie.dtd">
<ROOT>
    <row>
      <field name="buildid">26960</field>
      <field name="cast(status as char)">Filesystem           1K-blocks      Used Available Use% Mounted on
C:cygwinin        285217976  88055920 197162056  31% /usr/bin
C:cygwinlib        285217976  88055920 197162056  31% /usr/lib
C:cygwin            285217976  88055920 197162056  31% /
c:                   285217976  88055920 197162056  31% /cygdrive/c
d:                   285217976  88055920 197162056  31% /cygdrive/d</field>
      <field name="eventtime">2011-05-25 16:26:09</field>
      <field name="schedulerid">13</field>
    </row>

and I am trying to parse out the individual fields (buildid, status, eventtime, etc) but I am getting none as the result of all of my function calls, here is what I am doing:

log("Parsing XML file...")
try:
    xml = ET.parse(xml_file)
except Exception, inst:
    print "Unexpected error opening %s: %s" % (file, inst)
    sys.exit(1)
log("Parsing Complete")

#store the root of the element tree
root = xml.getroot()

zombies = []
for zombie in root.findall('row/'):
    #read the zombie data
    buildID     = zombie.get('buildid')
    print buildID
    status      = zombie.get('cast(status as char')
    print status
    eventTime   = zombie.get('eventtime')
    print eventTime
    schedulerID = zombie.get('schedulerid')
    print schedulerID

    #create a zombie object
    #z = Zombie(buildID, status, eventTime, schedulerID)
    #zombies.append(z)

can someone tell me what I am doing wrong?

Thanks

  • 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-23T01:19:08+00:00Added an answer on May 23, 2026 at 1:19 am

    Your zombie is a <row> element, not the <field> element that you want. When you call get() on it, you are trying to get an attribute on the <row> element, but what you want is the node value of the <field> element with that id.

    If you have Python 2.7, you can use ElementTree’s partial XPath support to find the correct element:

    build_id = zombie.find('field[name="buildid"]').text
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an xml file that looks like this: <args> <sometag value=abc /> <anothertag
I have an XML file that looks like this <comments> <text> <![CDATA[ <!--cached-Tue, 02
I have an XML file that looks like this... <foo> <bar>$VALUE$</bar> </foo> Is there
I have a xml file that looks like this: <DataTalk> <Posts> <TalkPost> <PostType>dialog</PostType> <User>ABBE</User>
So I have an XML file that looks a little like this <xml> <post>
Ok, so I have an XML file that pretty much looks like this: <Templates>
sI have an XML file that looks like the following... <a> <b> <version>1.0</version> <c>
I have a java class that looks like public class MyClass { private final
i would like to create a data feed that has the basic elements of
I've looked for a similar question, but the only one that was close didn't

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.