[line 49]
Yet another XML parsing class
This is similar to the "func" mode of XML_Parser but it borrows some concepts from DSSSL. The tag handler method to call is not only determined by the tag name but also potentially by the name of its parent tags, and the most specific handler method (that is the one including the maximum number of matching parent tags in its name) wins. This way it is possible to have e.g. tagstart_name as a general handler for a <name> tag while tagstart_function_name handles the more special case of a <name> tag within a <function> tag. Character data within a tag is collected and passed to the end tag handler. Tag names and attributes are managed using stack arrays. Attributes are not only passed to both the start and end tag handlers.
$attrStack = array()
[line 98]
We keep track of tag attributes so that we can also provide them to the end tag handlers
$data = ""
[line 70]
We collect cData in here
$dataLine = 0
[line 77]
We also try to remember where cData started
$error = false
[line 105]
There is no clean way to terminate parsing from within a handler ...
$filename = false
[line 112]
Input Filename
$fp = null
[line 119]
Input stream
$helper = false
[line 478]
The current helper (top of stack)
$helperPrev = false
[line 485]
The previous helper (top-1 of stack)
$helperStack = array()
[line 471]
A helper stack for collecting stuff
$parser = null
[line 56]
XML parser resource
$parserStack = array()
[line 63]
Parser stack for <include> management
$tagAliases = array()
[line 139]
Tag aliases
$tagAliasStack = array()
[line 91]
We also need to maintain a stack for tag aliases
$tagStack = array()
[line 84]
We maintain the current tag nesting structure here
$verbatim = false
[line 126]
Verbatim indicator
$verbatimDepth = 0
[line 133]
Verbatim taglevel depth
__construct (Constructor) [line 145]
addTagAlias [line 615]
void addTagAlias(
string
$tag, string
$alias)
Add a tag alias
Parameters:
string
$tag
—
Tag name
string
$alias
—
Alias for this tag
cDataHandler [line 432]
void cDataHandler(
resource
$XmlParser, string
$data)
Just collect cData for later use in tag end handlers
Parameters:
resource
$XmlParser
—
internal parser handle
string
$data
—
cData to collect
checkAttributes [line 580]
void checkAttributes(
array
&$attr, array
$optional, [array
$required = array()])
Check attributes
Parameters:
array
&$attr
—
actual attribute/value pairs
array
$optional
—
optinal attribute names with default values
array
$required
—
required attribute names
dataPiHandler [line 461]
void dataPiHandler(
resource
$XmlParser, string
$data)
Tread <?data PI sections like <![CDATA[
Parameters:
resource
$XmlParser
—
internal parser handle
string
$data
—
cData to collect
endHandler [line 384]
void endHandler(
resource
$XmlParser, string
$fulltag)
Try to find a tagend handler for this tag and call it
Parameters:
resource
$XmlParser
—
internal parser handle
string
$fulltag
—
tag name
extEntityHandler [line 215]
void extEntityHandler(
$parser,
$openEntityNames,
$base,
$systemId,
$publicId)
Create a new SAX parser to parse an external entity reference
Parameters:
$parser
—
$openEntityNames
—
$base
—
$systemId
—
$publicId
—
findHandler [line 289]
string findHandler(
string
$prefix)
Try to find best matching tag handler for current tag nesting
- Return: hndler method name or false if no handler found
- Access: protected
Parameters:
string
$prefix
—
handler method prefix
newParser [line 155]
Create a new SAX parser and associate it with this XmlParser instance
noAttributes [line 564]
void noAttributes(
$attr)
Check that no attributes are given
Parameters:
parse [line 248]
Perform the actual parsing
- Return: true on success
- Access: public
piHandler [line 444]
void piHandler(
resource
$XmlParser, string
$name, string
$data)
Delegate processing instructions
Parameters:
resource
$XmlParser
—
internal parser handle
string
$name
—
PI name
string
$data
—
PI content data
popHelper [line 504]
Pop something from the helper stack
popParser [line 190]
Replace current SAX parser with one popped from the parser stack
posString [line 202]
Generate current parse position as string for error messages
pushHelper [line 492]
void pushHelper(
mixed
$helper)
Push something on the helper stack
Parameters:
pushParser [line 177]
Push current SAX parser instance to the parser stack
setInputFile [line 234]
void setInputFile(
string
$filename)
Set file to parse
Parameters:
startHandler [line 309]
void startHandler(
resource
$XmlParser, string
$fulltag, array
$attr)
Try to find a tagstart handler for this tag and call it
Parameters:
resource
$XmlParser
—
internal parser handle
string
$fulltag
—
tag name
array
$attr
—
tag attributes
toBool [line 529]
bool toBool(
mixed
$arg, [string
$name = ""])
Convert various boolean value representation
Parameters:
mixed
$arg
—
value
string
$name
—
optional attribute name string for error messages
verbatim [line 277]