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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T06:49:51+00:00 2026-06-11T06:49:51+00:00

I am currently finishing up on a program that is suppose to parse a

  • 0

I am currently finishing up on a program that is suppose to parse a xml file and then set it up and then email it. I am almost done with it but I appear to be stuck and could use some assistance. I am trying to get the path attribute “dir” and “file” from the completed dictionary but i am getting a error with it. Here is part of the code that I am currently working on.

Update: I added the dictonary telling me if it its a Directory change or a Filename change a list along side the

def formatChangesByAuthor(changesByAuthor): 
    content = ''
    for author, changes in sorted(changesByAuthor.iteritems()):
    authorName = get_author_name( author );
    content += '       ***** Changes By '+authorName+'*****\n\n'
    for change in changes:
        rawDate = change['date']
        dateRepresentation = rawDate.strftime("%m/%d/%Y %I:%M:%S %p")
        content += '           Date: '+ dateRepresentation+'\n\n'

        path_change = change['paths']
        path_attribute= change['Attribute_changes']

        finalizedPathInformation = []

        for single_change in path_change:
            for single_output in path_attribute:  
                finalizedPathInformation.append(single_output+single_change)

        content +="           " + str(finalizedPathInformation) + "\n"

What I am hoping to get to work is when there are multiple path in paths it will do

filename : test.xml

directory location : /Testforlder/

for some reason it is showing me a memory error. I wonder if i could of wrote the path part better. Here is my error I am getting.

    content +="           " + str(finalizedPathInformation) + "\n" MemoryError

Now here is part of the xml file if it will help.

<log>
<logentry
revision="33185">
<author>glv</author>
<date>2012-08-06T21:01:52.494219Z</date>
<paths>
<path
action="M"
kind="file">/trunk/build.xml</path>
<path
 kind="dir"
 action="M">/trunk</path>
 </paths>
 <msg>PATCH_BRANCH:N/A
 BUG_NUMBER:N/A
 FEATURE_AFFECTED:N/A
 OVERVIEW:N/A 
 Testing the system log.
 </msg>
 </log>

Now i had the nodeValue saved in the dictionary but for some reason I can’t to get the attribute within the nodeValue to see if it has a “dir” or a “file” attribute at all. I am pretty sure I am doing something wrong somewhere. Any advice or help would be very appreciated and welcomed 🙂

  • 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-06-11T06:49:52+00:00Added an answer on June 11, 2026 at 6:49 am

    Obviously your path_change is a list. Try path_change[0].getAttribute('kind').

    I also propose to add debug output (print path_change before the call of getAttribute()) to find out more about your data structures.

    Of course if there’s a list you might want to process all elements in the list, not just the first. One way to do this could be:

    ...
        for single_change in path_change:
            kind = str(single_change.getAttribute("kind"))
            if kind == 'dir':
                content += '            Directory Location: '
            elif kind == 'file':
                content += '            Filename:  '
            else:
                raise SomeException("kind is neither dir nor file", kind, single_change)
            content += (str(single_change).
                        replace("u'","       \n").
                        replace("[","").
                        replace("',","").
                        replace("']", "\n ") + "\n")
    ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently finishing up a php program that backs up multiple Google Calendars which
I am finishing up a program that does a large number of calculations and
I'm working on a web site project that is currently tracked in svn but
I am currently finishing a site that the client wants to work on all
Currently, I'm finishing my very first iPhone app with MonoTouch. Having successfully done ad-hoc
Currently, I am writing a MiddleWare application that synchronizes information between and accounting application
Currently working with converting SQLException error messages into messages that are more useful for
What would cause a Clojure program to not immediately exit upon finishing the last
I am very close to finishing this project however I have a problem that
I'm currently finishing a huge Backbone.js application with JQuery, RequireJS and Underscore. There are

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.