neulab/docprompting-conala huggingface dataset:
xml.parsers.expat.errors.XML_ERROR_TEXT_DECL  
There was an error parsing a text declaration in an external entity.
xml.parsers.expat.errors.XML_ERROR_UNBOUND_PREFIX  
An undeclared prefix was found when namespace processing was enabled.
xml.parsers.expat.errors.XML_ERROR_UNCLOSED_CDATA_SECTION  
A CDATA marked section was not closed.
xml.parsers.expat.errors.XML_ERROR_UNCLOSED_TOKEN  
Some token (such as a start tag) was not closed before the end of the stream or the next token was encountered.
xml.parsers.expat.errors.XML_ERROR_UNDECLARING_PREFIX  
The document attempted to remove the namespace declaration associated with a prefix.
xml.parsers.expat.errors.XML_ERROR_UNDEFINED_ENTITY  
A reference was made to an entity which was not defined.
xml.parsers.expat.errors.XML_ERROR_UNKNOWN_ENCODING  
The document encoding is not supported by Expat.
xml.parsers.expat.errors.XML_ERROR_XML_DECL  
The document contained no document element at all.
xml.parsers.expat.ErrorString(errno)  
Returns an explanatory string for a given error number errno.
exception xml.parsers.expat.ExpatError  
The exception raised when Expat reports an error. See section ExpatError Exceptions for more information on interpreting Expat errors.
ExpatError.code  
Expat’s internal error number for the specific error. The errors.messages dictionary maps these error numbers to Expat’s error messages. For example: from xml.parsers.expat import ParserCreate, ExpatError, errors

p = ParserCreate()
try:
    p.Parse(some_xml_document)
except ExpatError as err:
    print("Error:", errors.messages[err.code])
 The errors module also provides error message constants and a dictionary codes mapping these messages back to the error codes, see below.
ExpatError.lineno  
Line number on which the error was detected. The first line is numbered 1.
ExpatError.offset  
Character offset into the line where the error occurred. The first column is numbered 0.
xml.parsers.expat.ParserCreate(encoding=None, namespace_separator=None)  
Creates and returns a new xmlparser object. encoding, if specified, must be a string naming the encoding used by the XML data. Expat doesn’t support as many encodings as Python does, and its repertoire of encodings can’t be extended; it supports UTF-8, UTF-16, ISO-8859-1 (Latin1), and ASCII. If encoding 1 is given it will override the implicit or explicit encoding of the document. Expat can optionally do XML namespace processing for you, enabled by providing a value for namespace_separator. The value must be a one-character string; a ValueError will be raised if the string has an illegal length (None is considered the same as omission). When namespace processing is enabled, element type names and attribute names that belong to a namespace will be expanded. The element name passed to the element handlers StartElementHandler and EndElementHandler will be the concatenation of the namespace URI, the namespace separator character, and the local part of the name. If the namespace separator is a zero byte (chr(0)) then the namespace URI and the local part will be concatenated without any separator. For example, if namespace_separator is set to a space character (' ') and the following document is parsed: <?xml version="1.0"?>
<root xmlns    = "http://default-namespace.org/"
      xmlns:py = "http://www.python.org/ns/">
  <py:elem1 />
  <elem2 xmlns="" />
</root>
 StartElementHandler will receive the following strings for each element: http://default-namespace.org/ root
http://www.python.org/ns/ elem1
elem2
 Due to limitations in the Expat library used by pyexpat, the xmlparser instance returned can only be used to parse a single XML document. Call ParserCreate for each document to provide unique parser instances.
xmlparser.AttlistDeclHandler(elname, attname, type, default, required)  
Called for each declared attribute for an element type. If an attribute list declaration declares three attributes, this handler is called three times, once for each attribute. elname is the name of the element to which the declaration applies and attname is the name of the attribute declared. The attribute type is a string passed as type; the possible values are 'CDATA', 'ID', 'IDREF', … default gives the default value for the attribute used when the attribute is not specified by the document instance, or None if there is no default value (#IMPLIED values). If the attribute is required to be given in the document instance, required will be true. This requires Expat version 1.95.0 or newer.
xmlparser.buffer_size  
The size of the buffer used when buffer_text is true. A new buffer size can be set by assigning a new integer value to this attribute. When the size is changed, the buffer will be flushed.
xmlparser.buffer_text  
Setting this to true causes the xmlparser object to buffer textual content returned by Expat to avoid multiple calls to the CharacterDataHandler() callback whenever possible. This can improve performance substantially since Expat normally breaks character data into chunks at every line ending. This attribute is false by default, and may be changed at any time.
xmlparser.buffer_used  
If buffer_text is enabled, the number of bytes stored in the buffer. These bytes represent UTF-8 encoded text. This attribute has no meaningful interpretation when buffer_text is false.
xmlparser.CharacterDataHandler(data)  
Called for character data. This will be called for normal character data, CDATA marked content, and ignorable whitespace. Applications which must distinguish these cases can use the StartCdataSectionHandler, EndCdataSectionHandler, and ElementDeclHandler callbacks to collect the required information.
xmlparser.CommentHandler(data)  
Called for comments. data is the text of the comment, excluding the leading '<!--' and trailing '-->'.
xmlparser.DefaultHandler(data)  
Called for any characters in the XML document for which no applicable handler has been specified. This means characters that are part of a construct which could be reported, but for which no handler has been supplied.
xmlparser.DefaultHandlerExpand(data)  
This is the same as the DefaultHandler(), but doesn’t inhibit expansion of internal entities. The entity reference will not be passed to the default handler.
xmlparser.ElementDeclHandler(name, model)  
Called once for each element type declaration. name is the name of the element type, and model is a representation of the content model.
xmlparser.EndCdataSectionHandler()  
Called at the end of a CDATA section.
xmlparser.EndDoctypeDeclHandler()  
Called when Expat is done parsing the document type declaration. This requires Expat version 1.2 or newer.
xmlparser.EndNamespaceDeclHandler(prefix)  
Called when the closing tag is reached for an element that contained a namespace declaration. This is called once for each namespace declaration on the element in the reverse of the order for which the StartNamespaceDeclHandler was called to indicate the start of each namespace declaration’s scope. Calls to this handler are made after the corresponding EndElementHandler for the end of the element.
xmlparser.EntityDeclHandler(entityName, is_parameter_entity, value, base, systemId, publicId, notationName)  
Called for all entity declarations. For parameter and internal entities, value will be a string giving the declared contents of the entity; this will be None for external entities. The notationName parameter will be None for parsed entities, and the name of the notation for unparsed entities. is_parameter_entity will be true if the entity is a parameter entity or false for general entities (most applications only need to be concerned with general entities). This is only available starting with version 1.95.0 of the Expat library.
xmlparser.ErrorCode  
Numeric code specifying the problem. This value can be passed to the ErrorString() function, or compared to one of the constants defined in the errors object.
xmlparser.ExternalEntityParserCreate(context[, encoding])  
Create a “child” parser which can be used to parse an external parsed entity referred to by content parsed by the parent parser. The context parameter should be the string passed to the ExternalEntityRefHandler() handler function, described below. The child parser is created with the ordered_attributes and specified_attributes set to the values of this parser.
xmlparser.ExternalEntityRefHandler(context, base, systemId, publicId)  
Called for references to external entities. base is the current base, as set by a previous call to SetBase(). The public and system identifiers, systemId and publicId, are strings if given; if the public identifier is not given, publicId will be None. The context value is opaque and should only be used as described below. For external entities to be parsed, this handler must be implemented. It is responsible for creating the sub-parser using ExternalEntityParserCreate(context), initializing it with the appropriate callbacks, and parsing the entity. This handler should return an integer; if it returns 0, the parser will raise an XML_ERROR_EXTERNAL_ENTITY_HANDLING error, otherwise parsing will continue. If this handler is not provided, external entities are reported by the DefaultHandler callback, if provided.
xmlparser.GetBase()  
Returns a string containing the base set by a previous call to SetBase(), or None if SetBase() hasn’t been called.
xmlparser.GetInputContext()  
Returns the input data that generated the current event as a string. The data is in the encoding of the entity which contains the text. When called while an event handler is not active, the return value is None.
xmlparser.NotationDeclHandler(notationName, base, systemId, publicId)  
Called for notation declarations. notationName, base, and systemId, and publicId are strings if given. If the public identifier is omitted, publicId will be None.
xmlparser.NotStandaloneHandler()  
Called if the XML document hasn’t been declared as being a standalone document. This happens when there is an external subset or a reference to a parameter entity, but the XML declaration does not set standalone to yes in an XML declaration. If this handler returns 0, then the parser will raise an XML_ERROR_NOT_STANDALONE error. If this handler is not set, no exception is raised by the parser for this condition.
xmlparser.ordered_attributes  
Setting this attribute to a non-zero integer causes the attributes to be reported as a list rather than a dictionary. The attributes are presented in the order found in the document text. For each attribute, two list entries are presented: the attribute name and the attribute value. (Older versions of this module also used this format.) By default, this attribute is false; it may be changed at any time.
xmlparser.Parse(data[, isfinal])  
Parses the contents of the string data, calling the appropriate handler functions to process the parsed data. isfinal must be true on the final call to this method; it allows the parsing of a single file in fragments, not the submission of multiple files. data can be the empty string at any time.
xmlparser.ParseFile(file)  
Parse XML data reading from the object file. file only needs to provide the read(nbytes) method, returning the empty string when there’s no more data.
xmlparser.ProcessingInstructionHandler(target, data)  
Called for every processing instruction.
xmlparser.SetBase(base)  
Sets the base to be used for resolving relative URIs in system identifiers in declarations. Resolving relative identifiers is left to the application: this value will be passed through as the base argument to the ExternalEntityRefHandler(), NotationDeclHandler(), and UnparsedEntityDeclHandler() functions.
xmlparser.SetParamEntityParsing(flag)  
Control parsing of parameter entities (including the external DTD subset). Possible flag values are XML_PARAM_ENTITY_PARSING_NEVER, XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE and XML_PARAM_ENTITY_PARSING_ALWAYS. Return true if setting the flag was successful.
xmlparser.specified_attributes  
If set to a non-zero integer, the parser will report only those attributes which were specified in the document instance and not those which were derived from attribute declarations. Applications which set this need to be especially careful to use what additional information is available from the declarations as needed to comply with the standards for the behavior of XML processors. By default, this attribute is false; it may be changed at any time.
xmlparser.StartCdataSectionHandler()  
Called at the start of a CDATA section. This and EndCdataSectionHandler are needed to be able to identify the syntactical start and end for CDATA sections.
xmlparser.StartDoctypeDeclHandler(doctypeName, systemId, publicId, has_internal_subset)  
Called when Expat begins parsing the document type declaration (<!DOCTYPE
...). The doctypeName is provided exactly as presented. The systemId and publicId parameters give the system and public identifiers if specified, or None if omitted. has_internal_subset will be true if the document contains and internal document declaration subset. This requires Expat version 1.2 or newer.
xmlparser.StartElementHandler(name, attributes)  
Called for the start of every element. name is a string containing the element name, and attributes is the element attributes. If ordered_attributes is true, this is a list (see ordered_attributes for a full description). Otherwise it’s a dictionary mapping names to values.
xmlparser.StartNamespaceDeclHandler(prefix, uri)  
Called when an element contains a namespace declaration. Namespace declarations are processed before the StartElementHandler is called for the element on which declarations are placed.
xmlparser.UnparsedEntityDeclHandler(entityName, base, systemId, publicId, notationName)  
Called for unparsed (NDATA) entity declarations. This is only present for version 1.2 of the Expat library; for more recent versions, use EntityDeclHandler instead. (The underlying function in the Expat library has been declared obsolete.)
xmlparser.UseForeignDTD([flag])  
Calling this with a true value for flag (the default) will cause Expat to call the ExternalEntityRefHandler with None for all arguments to allow an alternate DTD to be loaded. If the document does not contain a document type declaration, the ExternalEntityRefHandler will still be called, but the StartDoctypeDeclHandler and EndDoctypeDeclHandler will not be called. Passing a false value for flag will cancel a previous call that passed a true value, but otherwise has no effect. This method can only be called before the Parse() or ParseFile() methods are called; calling it after either of those have been called causes ExpatError to be raised with the code attribute set to errors.codes[errors.XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING].
xmlparser.XmlDeclHandler(version, encoding, standalone)  
Called when the XML declaration is parsed. The XML declaration is the (optional) declaration of the applicable version of the XML recommendation, the encoding of the document text, and an optional “standalone” declaration. version and encoding will be strings, and standalone will be 1 if the document is declared standalone, 0 if it is declared not to be standalone, or -1 if the standalone clause was omitted. This is only available with Expat version 1.95.0 or newer.
xml.parsers.expat.XMLParserType  
The type of the return values from the ParserCreate() function.
class xml.sax.handler.ContentHandler  
This is the main callback interface in SAX, and the one most important to applications. The order of events in this interface mirrors the order of the information in the document.
ContentHandler.characters(content)  
Receive notification of character data. The Parser will call this method to report each chunk of character data. SAX parsers may return all contiguous character data in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity so that the Locator provides useful information. content may be a string or bytes instance; the expat reader module always produces strings.  Note The earlier SAX 1 interface provided by the Python XML Special Interest Group used a more Java-like interface for this method. Since most parsers used from Python did not take advantage of the older interface, the simpler signature was chosen to replace it. To convert old code to the new interface, use content instead of slicing content with the old offset and length parameters.
ContentHandler.endDocument()  
Receive notification of the end of a document. The SAX parser will invoke this method only once, and it will be the last method invoked during the parse. The parser shall not invoke this method until it has either abandoned parsing (because of an unrecoverable error) or reached the end of input.
ContentHandler.endElement(name)  
Signals the end of an element in non-namespace mode. The name parameter contains the name of the element type, just as with the startElement() event.
ContentHandler.endElementNS(name, qname)  
Signals the end of an element in namespace mode. The name parameter contains the name of the element type, just as with the startElementNS() method, likewise the qname parameter.
ContentHandler.endPrefixMapping(prefix)  
End the scope of a prefix-URI mapping. See startPrefixMapping() for details. This event will always occur after the corresponding endElement() event, but the order of endPrefixMapping() events is not otherwise guaranteed.
ContentHandler.ignorableWhitespace(whitespace)  
Receive notification of ignorable whitespace in element content. Validating Parsers must use this method to report each chunk of ignorable whitespace (see the W3C XML 1.0 recommendation, section 2.10): non-validating parsers may also use this method if they are capable of parsing and using content models. SAX parsers may return all contiguous whitespace in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity, so that the Locator provides useful information.
ContentHandler.processingInstruction(target, data)  
Receive notification of a processing instruction. The Parser will invoke this method once for each processing instruction found: note that processing instructions may occur before or after the main document element. A SAX parser should never report an XML declaration (XML 1.0, section 2.8) or a text declaration (XML 1.0, section 4.3.1) using this method.
ContentHandler.setDocumentLocator(locator)  
Called by the parser to give the application a locator for locating the origin of document events. SAX parsers are strongly encouraged (though not absolutely required) to supply a locator: if it does so, it must supply the locator to the application by invoking this method before invoking any of the other methods in the DocumentHandler interface. The locator allows the application to determine the end position of any document-related event, even if the parser is not reporting an error. Typically, the application will use this information for reporting its own errors (such as character content that does not match an application’s business rules). The information returned by the locator is probably not sufficient for use with a search engine. Note that the locator will return correct information only during the invocation of the events in this interface. The application should not attempt to use it at any other time.
ContentHandler.skippedEntity(name)  
Receive notification of a skipped entity. The Parser will invoke this method once for each entity skipped. Non-validating processors may skip entities if they have not seen the declarations (because, for example, the entity was declared in an external DTD subset). All processors may skip external entities, depending on the values of the feature_external_ges and the feature_external_pes properties.
ContentHandler.startDocument()  
Receive notification of the beginning of a document. The SAX parser will invoke this method only once, before any other methods in this interface or in DTDHandler (except for setDocumentLocator()).
ContentHandler.startElement(name, attrs)  
Signals the start of an element in non-namespace mode. The name parameter contains the raw XML 1.0 name of the element type as a string and the attrs parameter holds an object of the Attributes interface (see The Attributes Interface) containing the attributes of the element. The object passed as attrs may be re-used by the parser; holding on to a reference to it is not a reliable way to keep a copy of the attributes. To keep a copy of the attributes, use the copy() method of the attrs object.
ContentHandler.startElementNS(name, qname, attrs)  
Signals the start of an element in namespace mode. The name parameter contains the name of the element type as a (uri,
localname) tuple, the qname parameter contains the raw XML 1.0 name used in the source document, and the attrs parameter holds an instance of the AttributesNS interface (see The AttributesNS Interface) containing the attributes of the element. If no namespace is associated with the element, the uri component of name will be None. The object passed as attrs may be re-used by the parser; holding on to a reference to it is not a reliable way to keep a copy of the attributes. To keep a copy of the attributes, use the copy() method of the attrs object. Parsers may set the qname parameter to None, unless the feature_namespace_prefixes feature is activated.
ContentHandler.startPrefixMapping(prefix, uri)  
Begin the scope of a prefix-URI Namespace mapping. The information from this event is not necessary for normal Namespace processing: the SAX XML reader will automatically replace prefixes for element and attribute names when the feature_namespaces feature is enabled (the default). There are cases, however, when applications need to use prefixes in character data or in attribute values, where they cannot safely be expanded automatically; the startPrefixMapping() and endPrefixMapping() events supply the information to the application to expand prefixes in those contexts itself, if necessary. Note that startPrefixMapping() and endPrefixMapping() events are not guaranteed to be properly nested relative to each-other: all startPrefixMapping() events will occur before the corresponding startElement() event, and all endPrefixMapping() events will occur after the corresponding endElement() event, but their order is not guaranteed.
class xml.sax.handler.DTDHandler  
Handle DTD events. This interface specifies only those DTD events required for basic parsing (unparsed entities and attributes).
DTDHandler.notationDecl(name, publicId, systemId)  
Handle a notation declaration event.
DTDHandler.unparsedEntityDecl(name, publicId, systemId, ndata)  
Handle an unparsed entity declaration event.
class xml.sax.handler.EntityResolver  
Basic interface for resolving entities. If you create an object implementing this interface, then register the object with your Parser, the parser will call the method in your object to resolve all external entities.
EntityResolver.resolveEntity(publicId, systemId)  
Resolve the system identifier of an entity and return either the system identifier to read from as a string, or an InputSource to read from. The default implementation returns systemId.
class xml.sax.handler.ErrorHandler  
Interface used by the parser to present error and warning messages to the application. The methods of this object control whether errors are immediately converted to exceptions or are handled in some other way.
ErrorHandler.error(exception)  
Called when the parser encounters a recoverable error. If this method does not raise an exception, parsing may continue, but further document information should not be expected by the application. Allowing the parser to continue may allow additional errors to be discovered in the input document.
ErrorHandler.fatalError(exception)  
Called when the parser encounters an error it cannot recover from; parsing is expected to terminate when this method returns.
ErrorHandler.warning(exception)  
Called when the parser presents minor warning information to the application. Parsing is expected to continue when this method returns, and document information will continue to be passed to the application. Raising an exception in this method will cause parsing to end.