pydoc > pyexpat

📦 NAME

pyexpat — Python wrapper for Expat parser 🐍⚡

🚀 Quick Reference

Use Case Command Description
🔧 Create parser pyexpat.ParserCreate(...) 🔨 Return a new XML parser object
📄 Parse XML string xmlparser.Parse(data, isfinal=False) 📥 Parse XML data — set isfinal=True at end of input
📁 Parse XML file xmlparser.ParseFile(file) 📂 Parse XML data from a file-like object
🌐 Set base URL xmlparser.SetBase(base) 📍 Set the base URL for the parser
❌ Get error string pyexpat.ErrorString(code) 💬 Return string error description for given error number
🔗 External entity parser xmlparser.ExternalEntityParserCreate(...) 🌍 Create a parser for parsing an external entity based on info passed to ExternalEntityRefHandler
📏 Get input context xmlparser.GetInputContext() 📝 Return the untranslated text of the input that caused the current event
⚙️ Set param entity parsing xmlparser.SetParamEntityParsing(flag) 🎛️ Controls parsing of parameter entities (including external DTD subset)
🌐 Use foreign DTD xmlparser.UseForeignDTD(flag=True) 📜 Allows the application to provide an artificial external subset if one is not specified

📚 SUBMODULES

🏛️ CLASSES

🔴 ExpatError

class ExpatError(builtins.Exception)
 |  Method resolution order:
 |      ExpatError
 |      builtins.Exception
 |      builtins.BaseException
 |      builtins.object
 |
 |  Data descriptors defined here:
 |
 |  __weakref__
 |      list of weak references to the object (if defined)
 |
 |  ----------------------------------------------------------------------
 |  Methods inherited from builtins.Exception:
 |
 |  __init__(self, /, *args, **kwargs)
 |      Initialize self.  See help(type(self)) for accurate signature.
 |
 |  ----------------------------------------------------------------------
 |  Static methods inherited from builtins.Exception:
 |
 |  __new__(*args, **kwargs) from builtins.type
 |      Create and return a new object.  See help(type) for accurate signature.
 |
 |  ----------------------------------------------------------------------
 |  Methods inherited from builtins.BaseException:
 |
 |  __delattr__(self, name, /)
 |      Implement delattr(self, name).
 |
 |  __getattribute__(self, name, /)
 |      Return getattr(self, name).
 |
 |  __reduce__(...)
 |      Helper for pickle.
 |
 |  __repr__(self, /)
 |      Return repr(self).
 |
 |  __setattr__(self, name, value, /)
 |      Implement setattr(self, name, value).
 |
 |  __setstate__(...)
 |
 |  __str__(self, /)
 |      Return str(self).
 |
 |  with_traceback(...)
 |      Exception.with_traceback(tb) --
 |      set self.__traceback__ to tb and return self.
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors inherited from builtins.BaseException:
 |
 |  __cause__
 |      exception cause
 |
 |  __context__
 |      exception context
 |
 |  __dict__
 |
 |  __suppress_context__
 |
 |  __traceback__
 |
 |  args

🔁 The error attribute is an alias for ExpatError.

⚙️ XMLParserType

XMLParserType = class xmlparser(builtins.object)
 |  XML parser
 |
 |  Methods defined here:
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:

🔧 FUNCTIONS

📊 DATA

📁 FILE

(built-in)

pyexpat
📦 NAME 🚀 Quick Reference 📚 SUBMODULES 🏛️ CLASSES
🔴 ExpatError ⚙️ XMLParserType
🔧 FUNCTIONS 📊 DATA 📁 FILE

Generated by phpman v4.10.0-7-g98e9fd5 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-09-01 17:02 @216.73.216.239
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Valid XHTML 1.0 Transitional!Valid CSS!

^_top_^