| |
- exceptions.Exception(exceptions.BaseException)
-
- web.cxml.ParseError
-
- web.cxml.BadEscapeSeq
- web.cxml.CXMLParser
-
- web.cxml.CXMLConverter
- web.cxml.ElementParser
- web.cxml.ElementFactory
-
- web.cxml.DefaultElementFactory
- web.cxml.Token
- web.cxml.Toker
class CXMLConverter(CXMLParser) |
|
Converts CXML directly to XML on an output stream. |
|
Methods defined here:
- __init__(self, src, dst, srcName='<file>', initLineNum=1)
- fixAttrVal(self, attrVal)
- "Fixes" an attribute value by replacing all forbidden characters
with acceptable ones.
- handleAttrDef(self, attr, val, srcName, lineNum)
- handleAttrWS(self, val)
- handleCDataEnd(self)
- handleCDataStart(self)
- handleCharData(self, data)
- handleCommentEnd(self)
- handleCommentStart(self)
- handleContentStart(self)
- handleElemEnd(self)
- handleElemStart(self, elemName, srcName, lineNum)
- handleEntityRef(self, val)
- handlePIEnd(self)
- handlePIStart(self)
- handleSpecialData(self, data)
Methods inherited from CXMLParser:
- fixCharData(self, tok)
- Fixes character data by escaping markup start chars and unescaping
CXML escape sequences.
- handleContentEnd(self)
- Called when element content is finished.
- parse(self)
- parseAttrDef(self, attrName)
- Parses an attribute definition through the following comma
or end paren. Returns true if there are more attribute definitions
to come.
parms:
attrName::
[string]
- parseElem(self, elemName)
- parseElems(self, nested)
- Parses all alements
parms:
nested::
[boolean] true if we are in a nested context - if not nested,
a bare '}' raises an exception.
- parseLiteral(self, begin, end, endTok)
- Parse any of the special "literal" tags that contain no markup
(processing instructions, comments and CDATA).
parms:
begin::
[callable<>] function to call before content.
end::
[callable<>] function to call after content.
endTag::
[int] type of token signalling the end of the literal.
|
class CXMLParser |
|
Parses CXML. This is an abstract base class. Derived classes must
implement all "handle" methods. |
|
Methods defined here:
- __init__(self, src, srcName='<file>', initLineNum=1)
- parms:
src::
[file.read] source stream
srcName::
[string] source file name
initLineNum::
[int] initial line number
- fixCharData(self, tok)
- Fixes character data by escaping markup start chars and unescaping
CXML escape sequences.
- handleAttrDef(self, attr, val, srcName, lineNum)
- handleAttrWS(self, val)
- Called for white space in an attribute list.
- handleCDataEnd(self)
- handleCDataStart(self)
- handleCharData(self, data)
- handleCommentEnd(self)
- handleCommentStart(self)
- handleContentEnd(self)
- Called when element content is finished.
- handleContentStart(self)
- Called when element content is started.
- handleElemEnd(self)
- Called to terminate the current element.
- handleElemStart(self, elemName, srcName, lineNum)
- handleEntityRef(self, val)
- handlePIEnd(self)
- handlePIStart(self)
- handleSpecialData(self, data)
- This is called for content of a processing instruction, comment,
or CData block.
- parse(self)
- parseAttrDef(self, attrName)
- Parses an attribute definition through the following comma
or end paren. Returns true if there are more attribute definitions
to come.
parms:
attrName::
[string]
- parseElem(self, elemName)
- parseElems(self, nested)
- Parses all alements
parms:
nested::
[boolean] true if we are in a nested context - if not nested,
a bare '}' raises an exception.
- parseLiteral(self, begin, end, endTok)
- Parse any of the special "literal" tags that contain no markup
(processing instructions, comments and CDATA).
parms:
begin::
[callable<>] function to call before content.
end::
[callable<>] function to call after content.
endTag::
[int] type of token signalling the end of the literal.
|
class ElementFactory |
|
Abstract base class for element factories - used to create specific
@spug.web.xmlo.Element derived classes. |
|
Methods defined here:
- makeElement(self, name, actualNS)
- Creates and returns a new element object (@spug.web.xmlo.Element
derivative).
Must be implemented by derived class.
parms:
name::
[string or tuple<string, string>] new element name.
If a tuple, this is the explicit namespace URL and the local
name.
actualNS::
[string or None] The actual namespace of the element.
|
class ElementParser(CXMLParser) |
|
Creates a @spug.web.xmlo.Element tree from the parsed CXML. |
|
Methods defined here:
- __init__(self, src, elementFactory=<web.cxml.DefaultElementFactory instance at 0x402ab68c>, srcName='<file>', initLineNum=1)
- parms:
src::
[file.read] source stream
elementFactory::
[@ElementFactory] factory used to create element objects.
srcName::
[string] source file or stream name
initLineNum::
[int] initial line number
- getRootElem(self)
- handleAttrDef(self, attr, val, srcName, lineNum)
- handleCDataEnd(self)
- handleCDataStart(self)
- handleCharData(self, data)
- handleContentStart(self)
- Called when element content is started.
- handleElemEnd(self)
- Called to terminate the current element.
- handleElemStart(self, elemName, srcName, lineNum)
- handleEntityRef(self, val)
- handleSpecialData(self, data)
- This is called for content of a processing instruction, comment,
or CData block.
Methods inherited from CXMLParser:
- fixCharData(self, tok)
- Fixes character data by escaping markup start chars and unescaping
CXML escape sequences.
- handleAttrWS(self, val)
- Called for white space in an attribute list.
- handleCommentEnd(self)
- handleCommentStart(self)
- handleContentEnd(self)
- Called when element content is finished.
- handlePIEnd(self)
- handlePIStart(self)
- parse(self)
- parseAttrDef(self, attrName)
- Parses an attribute definition through the following comma
or end paren. Returns true if there are more attribute definitions
to come.
parms:
attrName::
[string]
- parseElem(self, elemName)
- parseElems(self, nested)
- Parses all alements
parms:
nested::
[boolean] true if we are in a nested context - if not nested,
a bare '}' raises an exception.
- parseLiteral(self, begin, end, endTok)
- Parse any of the special "literal" tags that contain no markup
(processing instructions, comments and CDATA).
parms:
begin::
[callable<>] function to call before content.
end::
[callable<>] function to call after content.
endTag::
[int] type of token signalling the end of the literal.
|
class Toker |
| |
Methods defined here:
- __init__(self, src, srcName='<file>', initLineNum=1)
- parms:
src::
[file.readline] source for tokenizer
srcName::
[string] source name
initLineNum::
[int] initial line number
- __iter__(self)
- next(self)
Data and other attributes defined here:
- CDATA = 0
- COMMA = 12
- COMMENT = 15
- DQSTRING = 7
- END = -1
- ENDCDATA = 18
- ENDCOMMENT = 16
- ENDPI = 14
- ENTITYREF = 19
- EQUALS = 4
- EXPCDATA = 17
- LCURL = 5
- LPAREN = 2
- NAME = 11
- PI = 13
- RCURL = 6
- RPAREN = 3
- SEMICOLON = 10
- SQSTRING = 8
- ST_CDATA = 0
- ST_COMMENT = 3
- ST_ENTITY = 5
- ST_EXPCDATA = 4
- ST_MARKUP = 1
- ST_PI = 2
- TAG = 1
- WS = 9
| |