4Suite API Documentation

Module amara.pyxml_standins

Classes:
Globals:

Classes

class DeclHandler
Optional SAX2 handler for DTD declaration events.
Note that some DTD declarations are already reported through the
DTDHandler interface. All events reported to this handler will
occur between the startDTD and endDTD events of the
LexicalHandler.

To set the DeclHandler for an XMLReader, use the setProperty method
with the identifier http://xml.org/sax/handlers/DeclHandler.

Methods

attributeDecl(self, elem_name, attr_name, type, value_def, value)
Report an attribute type declaration.
Only the first declaration will be reported. The type will be
one of the strings "CDATA", "ID", "IDREF", "IDREFS",
"NMTOKEN", "NMTOKENS", "ENTITY", "ENTITIES", or "NOTATION", or
a list of names (in the case of enumerated definitions).

elem_name is the element type name, attr_name the attribute
type name, type a string representing the attribute type,
value_def a string representing the default declaration
('#IMPLIED', '#REQUIRED', '#FIXED' or None). value is a string
representing the attribute's default value, or None if there
is none.
elementDecl(self, elem_name, content_model)
Report an element type declaration.
Only the first declaration will be reported.

content_model is the string 'EMPTY', the string 'ANY' or the content
model structure represented as tuple (separator, tokens, modifier)
where separator is the separator in the token list (that is, '|' or
','), tokens is the list of tokens (element type names or tuples
representing parentheses) and modifier is the quantity modifier
('*', '?' or '+').
externalEntityDecl(self, name, public_id, system_id)
Report a parsed entity declaration. (Unparsed entities are reported to the DTDHandler.)
Only the first declaration for each entity will be reported.

name is the name of the entity. If it is a parameter entity,
the name will begin with '%'. public_id and system_id are the
public and system identifiers of the entity. public_id will be
None if none were declared.
internalEntityDecl(self, name, value)
Report an internal entity declaration.
Only the first declaration of an entity will be reported.

name is the name of the entity. If it is a parameter entity,
the name will begin with '%'. value is the replacement text of
the entity.
class LexicalHandler
Optional SAX2 handler for lexical events.
This handler is used to obtain lexical information about an XML
document, that is, information about how the document was encoded
(as opposed to what it contains, which is reported to the
ContentHandler), such as comments and CDATA marked section
boundaries.

To set the LexicalHandler of an XMLReader, use the setProperty
method with the property identifier
'http://xml.org/sax/handlers/LexicalHandler'. There is no
guarantee that the XMLReader will support or recognize this
property.

Methods

comment(self, content)
Reports a comment anywhere in the document (including the DTD and outside the document element).
content is a string that holds the contents of the comment.
endCDATA(self)
Reports the end of a CDATA marked section.
endDTD(self)
Signals the end of DTD declarations.
endEntity(self, name)
Reports the end of an entity. name is the name of the entity, and follows the same conventions as for startEntity.
startCDATA(self)
Reports the beginning of a CDATA marked section.
The contents of the CDATA marked section will be reported
through the characters event.
startDTD(self, name, public_id, system_id)
Report the start of the DTD declarations, if the document has an associated DTD.
A startEntity event will be reported before declaration events
from the external DTD subset are reported, and this can be
used to infer from which subset DTD declarations derive.

name is the name of the document element type, public_id the
public identifier of the DTD (or None if none were supplied)
and system_id the system identfier of the external subset (or
None if none were supplied).
startEntity(self, name)
Report the beginning of an entity.
The start and end of the document entity is not reported. The
start and end of the external DTD subset is reported with the
pseudo-name '[dtd]'.

Skipped entities will be reported through the skippedEntity
event of the ContentHandler rather than through this event.

name is the name of the entity. If it is a parameter entity,
the name will begin with '%'.

Globals

all_features = ['http://xml.org/sax/features/namespaces', 'http://xml.org/sax/features/namespace-prefixes', 'http://xml.org/sax/features/string-interning', 'http://xml.org/sax/features/validation', 'http://xml.org/sax/features/external-general-entities', 'http://xml.org/sax/features/external-parameter-entities']
all_properties = ['http://xml.org/sax/properties/lexical-handler', 'http://xml.org/sax/properties/dom-node', 'http://xml.org/sax/properties/declaration-handler', 'http://xml.org/sax/properties/xml-string', 'http://www.python.org/sax/properties/encoding', 'http://www.python.org/sax/properties/interning-dict']
feature_external_ges = 'http://xml.org/sax/features/external-general-entities'
feature_external_pes = 'http://xml.org/sax/features/external-parameter-entities'
feature_namespace_prefixes = 'http://xml.org/sax/features/namespace-prefixes'
feature_namespaces = 'http://xml.org/sax/features/namespaces'
feature_string_interning = 'http://xml.org/sax/features/string-interning'
feature_validation = 'http://xml.org/sax/features/validation'
property_declaration_handler = 'http://xml.org/sax/properties/declaration-handler'
property_dom_node = 'http://xml.org/sax/properties/dom-node'
property_encoding = 'http://www.python.org/sax/properties/encoding'
property_interning_dict = 'http://www.python.org/sax/properties/interning-dict'
property_lexical_handler = 'http://xml.org/sax/properties/lexical-handler'
property_xml_string = 'http://xml.org/sax/properties/xml-string'