📄 expat.html
字号:
<li><strong><a name="item_notation">Notation (Parser, Notation, Base, Sysid, Pubid)</a></strong>
<p>This is called for a declaration of notation. Notation is the notation name.
Base is the base to be used for resolving a relative URI. Sysid is the system
id. Pubid is the public id. Base, Sysid, and Pubid may all be undefined.</p>
</li>
<li><strong><a name="item_externent">ExternEnt (Parser, Base, Sysid, Pubid)</a></strong>
<p>This is called when an external entity is referenced. Base is the base to be
used for resolving a relative URI. Sysid is the system id. Pubid is the public
id. Base, and Pubid may be undefined.</p>
<p>This handler should either return a string, which represents the contents of
the external entity, or return an open filehandle that can be read to obtain
the contents of the external entity, or return undef, which indicates the
external entity couldn't be found and will generate a parse error.</p>
<p>If an open filehandle is returned, it must be returned as either a glob
(*FOO) or as a reference to a glob (e.g. an instance of IO::Handle).</p>
</li>
<li><strong><a name="item_externentfin">ExternEntFin (Parser)</a></strong>
<p>This is called after an external entity has been parsed. It allows
applications to perform cleanup on actions performed in the above
ExternEnt handler.</p>
</li>
<li><strong><a name="item_entity">Entity (Parser, Name, Val, Sysid, Pubid, Ndata, IsParam)</a></strong>
<p>This is called when an entity is declared. For internal entities, the Val
parameter will contain the value and the remaining three parameters will
be undefined. For external entities, the Val parameter
will be undefined, the Sysid parameter will have the system id, the Pubid
parameter will have the public id if it was provided (it will be undefined
otherwise), the Ndata parameter will contain the notation for unparsed
entities. If this is a parameter entity declaration, then the IsParam
parameter is true.</p>
<p>Note that this handler and the Unparsed handler above overlap. If both are
set, then this handler will not be called for unparsed entities.</p>
</li>
<li><strong><a name="item_element">Element (Parser, Name, Model)</a></strong>
<p>The element handler is called when an element declaration is found. Name is
the element name, and Model is the content model as an
XML::Parser::ContentModel object. See <a href="#xml__parser__contentmodel_methods">XML::Parser::ContentModel Methods</a>
for methods available for this class.</p>
</li>
<li><strong><a name="item_attlist">Attlist (Parser, Elname, Attname, Type, Default, Fixed)</a></strong>
<p>This handler is called for each attribute in an ATTLIST declaration.
So an ATTLIST declaration that has multiple attributes
will generate multiple calls to this handler. The Elname parameter is the
name of the element with which the attribute is being associated. The Attname
parameter is the name of the attribute. Type is the attribute type, given as
a string. Default is the default value, which will either be "#REQUIRED",
"#IMPLIED" or a quoted string (i.e. the returned string will begin and end
with a quote character). If Fixed is true, then this is a fixed attribute.</p>
</li>
<li><strong><a name="item_doctype">Doctype (Parser, Name, Sysid, Pubid, Internal)</a></strong>
<p>This handler is called for DOCTYPE declarations. Name is the document type
name. Sysid is the system id of the document type, if it was provided,
otherwise it's undefined. Pubid is the public id of the document type,
which will be undefined if no public id was given. Internal will be
true or false, indicating whether or not the doctype declaration contains
an internal subset.</p>
</li>
<li><strong><a name="item_doctypefin">DoctypeFin (Parser)</a></strong>
<p>This handler is called after parsing of the DOCTYPE declaration has finished,
including any internal or external DTD declarations.</p>
</li>
<li><strong><a name="item_xmldecl">XMLDecl (Parser, Version, Encoding, Standalone)</a></strong>
<p>This handler is called for XML declarations. Version is a string containg
the version. Encoding is either undefined or contains an encoding string.
Standalone is either undefined, or true or false. Undefined indicates
that no standalone parameter was given in the XML declaration. True or
false indicates "yes" or "no" respectively.</p>
</li>
</ul>
<dt><strong><a name="item_namespace"><code>namespace(name)</code></a></strong>
<dd>
<p>Return the URI of the namespace that the name belongs to. If the name doesn't
belong to any namespace, an undef is returned. This is only valid on names
received through the Start or End handlers from a single document, or through
a call to the generate_ns_name method. In other words, don't use names
generated from one instance of XML::Parser::Expat with other instances.</p>
</dd>
</li>
<dt><strong><a name="item_eq_name">eq_name(name1, name2)</a></strong>
<dd>
<p>Return true if name1 and name2 are identical (i.e. same name and from
the same namespace.) This is only meaningful if both names were obtained
through the Start or End handlers from a single document, or through
a call to the generate_ns_name method.</p>
</dd>
</li>
<dt><strong><a name="item_generate_ns_name">generate_ns_name(name, namespace)</a></strong>
<dd>
<p>Return a name, associated with a given namespace, good for using with the
above 2 methods. The namespace argument should be the namespace URI, not
a prefix.</p>
</dd>
</li>
<dt><strong><a name="item_new_ns_prefixes">new_ns_prefixes</a></strong>
<dd>
<p>When called from a start tag handler, returns namespace prefixes declared
with this start tag. If called elsewere (or if there were no namespace
prefixes declared), it returns an empty list. Setting of the default
namespace is indicated with '#default' as a prefix.</p>
</dd>
</li>
<dt><strong><a name="item_expand_ns_prefix"><code>expand_ns_prefix(prefix)</code></a></strong>
<dd>
<p>Return the uri to which the given prefix is currently bound. Returns
undef if the prefix isn't currently bound. Use '#default' to find the
current binding of the default namespace (if any).</p>
</dd>
</li>
<dt><strong><a name="item_current_ns_prefixes">current_ns_prefixes</a></strong>
<dd>
<p>Return a list of currently bound namespace prefixes. The order of the
the prefixes in the list has no meaning. If the default namespace is
currently bound, '#default' appears in the list.</p>
</dd>
</li>
<dt><strong><a name="item_recognized_string">recognized_string</a></strong>
<dd>
<p>Returns the string from the document that was recognized in order to call
the current handler. For instance, when called from a start handler, it
will give us the the start-tag string. The string is encoded in UTF-8.
This method doesn't return a meaningful string inside declaration handlers.</p>
</dd>
</li>
<dt><strong><a name="item_original_string">original_string</a></strong>
<dd>
<p>Returns the verbatim string from the document that was recognized in
order to call the current handler. The string is in the original document
encoding. This method doesn't return a meaningful string inside declaration
handlers.</p>
</dd>
</li>
<dt><strong><a name="item_default_current">default_current</a></strong>
<dd>
<p>When called from a handler, causes the sequence of characters that generated
the corresponding event to be sent to the default handler (if one is
registered). Use of this method is deprecated in favor the recognized_string
method, which you can use without installing a default handler. This
method doesn't deliver a meaningful string to the default handler when
called from inside declaration handlers.</p>
</dd>
</li>
<dt><strong><a name="item_xpcroak"><code>xpcroak(message)</code></a></strong>
<dd>
<p>Concatenate onto the given message the current line number within the
XML document plus the message implied by ErrorContext. Then croak with
the formed message.</p>
</dd>
</li>
<dt><strong><a name="item_xpcarp"><code>xpcarp(message)</code></a></strong>
<dd>
<p>Concatenate onto the given message the current line number within the
XML document plus the message implied by ErrorContext. Then carp with
the formed message.</p>
</dd>
</li>
<dt><strong><a name="item_current_line">current_line</a></strong>
<dd>
<p>Returns the line number of the current position of the parse.</p>
</dd>
</li>
<dt><strong><a name="item_current_column">current_column</a></strong>
<dd>
<p>Returns the column number of the current position of the parse.</p>
</dd>
</li>
<dt><strong><a name="item_current_byte">current_byte</a></strong>
<dd>
<p>Returns the current position of the parse.</p>
</dd>
</li>
<dt><strong><a name="item_base">base([NEWBASE]);</a></strong>
<dd>
<p>Returns the current value of the base for resolving relative URIs. If
NEWBASE is supplied, changes the base to that value.</p>
</dd>
</li>
<dt><strong><a name="item_context">context</a></strong>
<dd>
<p>Returns a list of element names that represent open elements, with the
last one being the innermost. Inside start and end tag handlers, this
will be the tag of the parent element.</p>
</dd>
</li>
<dt><strong><a name="item_current_element">current_element</a></strong>
<dd>
<p>Returns the name of the innermost currently opened element. Inside
start or end handlers, returns the parent of the element associated
with those tags.</p>
</dd>
</li>
<dt><strong><a name="item_in_element"><code>in_element(NAME)</code></a></strong>
<dd>
<p>Returns true if NAME is equal to the name of the innermost currently opened
element. If namespace processing is being used and you want to check
against a name that may be in a namespace, then use the generate_ns_name
method to create the NAME argument.</p>
</dd>
</li>
<dt><strong><a name="item_within_element"><code>within_element(NAME)</code></a></strong>
<dd>
<p>Returns the number of times the given name appears in the context list.
If namespace processing is being used and you want to check
against a name that may be in a namespace, then use the generate_ns_name
method to create the NAME argument.</p>
</dd>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -