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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T20:58:28+00:00 2026-06-11T20:58:28+00:00

There are a lot of ways in python provided by the standard installation to

  • 0

There are a lot of ways in python provided by the standard installation to process an XML, even more as external packages, see http://wiki.python.org/moin/PythonXml.

For my project I use minidom, it does what I need, but the error reporting is rather telegraphic, for example:

no element found: line 7, column 0

which is correct but is not very human readable, no hinting to which element might be needed. Because of lack of information, I cannot report the error to an user.

This is just an example but there are more cases where minidom could be more detailed but is not. So I need something detailed, an error detailed enough that I can pass the parsing error back to an user.

Which of the standard XML „processing solutions” has the most detailed error reporting, if none which of the external packages for XML support has that?

The xml file that was used for parsing, which in the code is used as config.xml is:

<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns="http://www.w3.org/ns/widgets">
    <icon src="icon.png"/>
    <content src="index.html"/>
<name>sample</name>
  • 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-11T20:58:29+00:00Added an answer on June 11, 2026 at 8:58 pm

    I tried to do a survey on all the parsers from the above link to see which one has the most useful error reporting, I stopped at lxml:

    import xml.dom.minidom as  md
    md.parse("config.xml")
    #xml.parsers.expat.ExpatError: no element found: line 7, column 0
    
    
    import elementtree.ElementTree as ET
    tree = ET.parse("config.xml")
    #xml.parsers.expat.ExpatError: no element found: line 7, column 0
    
    
    from xml import sax
    parser = sax.make_parser()
    parser.parse("config.xml")
    #xml.sax._exceptions.SAXParseException: config.xml:7:0: no element found
    
    
    import xml.etree.cElementTree as et
    et.parse("config.xml")
    #cElementTree.ParseError: no element found: line 7, column 0
    
    import xml.dom.pulldom as pd
    doc = pd.parse("config.xml")
    for event, node in doc:
         print event, node
    
    #xml.sax._exceptions.SAXParseException: <unknown>:7:0: no element found
    
    import lxml.etree
    tree = lxml.etree.parse("config.xml")
    
    #lxml.etree.XMLSyntaxError: Premature end of data in tag widget line 2, line 7, column 1
    

    The conclusion is that lxml library had the best error reporting from the above list:

    "Premature end of data in tag widget line 2, line 7, column 1"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There are a lot of ways to replace many characters with one. s/a\{100\}/a/ Is
I see there are lot's of examples in Ext JS where instead of actually
In C++ there are a lot of ways that you can write code that
There a lot of different ways a Silverlight application can connect back to it’
I understand there are a lot of ways of encrypting an SQLConnection string so
There are a lot of ways to build custom controls for Asp.Net. Some people
I know there are a lot of ways to compare VALUE and REFERENCES in
There are a lot of ways here to secure your code from SQL injection
I have been through solutions and found that there are a lot of ways
I know that there are lot's of questons on this, but all seem to

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.