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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:58:43+00:00 2026-06-03T22:58:43+00:00

I am working with a broken XML-RPC server, and while I have submitted a

  • 0

I am working with a broken XML-RPC server, and while I have submitted a support request to have it fixed, there is a bug whereby it is reporting the bytelength of a utf-8 response as the character count, leading to the truncation of the XML I am receiving.

I expect this will be fixed at some point soon, however I am currently investigating this as part of a set of tools, and really need to get it working. Currently I have monkey-patched xmlrpclib to reverse the parsing on exception and allow me to manually feed the parser a corrected version of the response, but considering the nature of XML there must be a way to do this programatically and therefore allow me to use the XML-RPC server as if it does not have this bug.

The amount of truncation is only a portion of the closing tags, so if there were an inbuilt way to get the broken xml tree, dump it with all tags closed, and then parse this instead, it would allow me to get on with my work – I’m currently looking at rolling my own, but any help would be much appreciated, I can’t imagine I’m the first person to ever want to perform error-correction on xml, but if I don’t find a solution pre-made I’ll push mine to git and link it from here.

  • 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-03T22:58:45+00:00Added an answer on June 3, 2026 at 10:58 pm

    Here’s a quick snippet – the key is that sax parsers generate events as they go through, so they allow you to process the content up to the point it breaks.

    #!/usr/bin/env python
    
    import sys
    from xml.sax import handler, make_parser
    
    class TagHandler(handler.ContentHandler):
        def __init__(self):
            handler.ContentHandler.__init__(self)
    
            self.stack = []
    
    
        def startElement(self, name, attrs):
            self.stack.append(name)
    
        def endElement(self, name):
            # TODO: might want to just confirm that the element matches the top of the stack here
            self.stack.pop()
    
    
        def finish_document(self):
            return "\n".join(["</%s>" % tag for tag in reversed(self.stack)])
    
    
    parser = make_parser()
    handler = TagHandler()
    parser.setContentHandler(handler)
    
    try:
        parser.parse(sys.argv[1])
    
    except:
        # TODO: something more intelligent than just printing out the
        # constructed end of the document. Like appending it to the source
        # and repeating whatever you did to make this processing necessary.
        print handler.finish_document()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been working with xml lately. And have noticed a bit of a phenomenon
I'm working on an iOS app and have broken the codebase into two separate
I'm working on an Eclipse RCP project on Eclipse 3.6 that's broken up into
I've implemented a messaging system over SQL Server Service Broker. It is working great,
Working on a page with multiple sections. at the very top there is a
My git repository was suddenly broken. I had been working as usual, but when
I am currently working on securing a web application using spring-security 3.0. I have
I have a form I'm working on and I'm trying to align all my
I am working on some buttons. I want to have a rollover state and
Here is a working version http://jsfiddle.net/tH78C/ Here is a broken version (Zooming widget is

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.