⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 reference.html

📁 这是symbian下的实现XML解析的源代码。里面包括解析器和解析例子代码。
💻 HTML
📖 第 1 页 / 共 5 页
字号:
</div>

<div class="handler">
<pre class="setter" id="XML_SetCommentHandler">
void XMLCALL
XML_SetCommentHandler(XML_Parser p,
                      XML_CommentHandler cmnt)
</pre>
<pre class="signature">
typedef void
(XMLCALL *XML_CommentHandler)(void *userData,
                              const XML_Char *data);
</pre>
<p>Set a handler for comments. The data is all text inside the comment
delimiters.</p>
</div>

<div class="handler">
<pre class="setter" id="XML_SetStartCdataSectionHandler">
void XMLCALL
XML_SetStartCdataSectionHandler(XML_Parser p,
                                XML_StartCdataSectionHandler start);
</pre>
<pre class="signature">
typedef void
(XMLCALL *XML_StartCdataSectionHandler)(void *userData);
</pre>
<p>Set a handler that gets called at the beginning of a CDATA section.</p>
</div>

<div class="handler">
<pre class="setter" id="XML_SetEndCdataSectionHandler">
void XMLCALL
XML_SetEndCdataSectionHandler(XML_Parser p,
                              XML_EndCdataSectionHandler end);
</pre>
<pre class="signature">
typedef void
(XMLCALL *XML_EndCdataSectionHandler)(void *userData);
</pre>
<p>Set a handler that gets called at the end of a CDATA section.</p>
</div>

<div class="handler">
<pre class="setter" id="XML_SetCdataSectionHandler">
void XMLCALL
XML_SetCdataSectionHandler(XML_Parser p,
                           XML_StartCdataSectionHandler start,
                           XML_EndCdataSectionHandler end)
</pre>
<p>Sets both CDATA section handlers with one call.</p>
</div>

<div class="handler">
<pre class="setter" id="XML_SetDefaultHandler">
void XMLCALL
XML_SetDefaultHandler(XML_Parser p,
                      XML_DefaultHandler hndl)
</pre>
<pre class="signature">
typedef void
(XMLCALL *XML_DefaultHandler)(void *userData,
                              const XML_Char *s,
                              int len);
</pre>

<p>Sets a handler for any characters in the document which wouldn't
otherwise be handled. This includes both data for which no handlers
can be set (like some kinds of DTD declarations) and data which could
be reported but which currently has no handler set.  The characters
are passed exactly as they were present in the XML document except
that they will be encoded in UTF-8 or UTF-16. Line boundaries are not
normalized. Note that a byte order mark character is not passed to the
default handler. There are no guarantees about how characters are
divided between calls to the default handler: for example, a comment
might be split between multiple calls.  Setting the handler with
this call has the side effect of turning off expansion of references
to internally defined general entities. Instead these references are
passed to the default handler.</p>

<p>See also <code><a
href="#XML_DefaultCurrent">XML_DefaultCurrent</a></code>.</p>
</div>

<div class="handler">
<pre class="setter" id="XML_SetDefaultHandlerExpand">
void XMLCALL
XML_SetDefaultHandlerExpand(XML_Parser p,
                            XML_DefaultHandler hndl)
</pre>
<pre class="signature">
typedef void
(XMLCALL *XML_DefaultHandler)(void *userData,
                              const XML_Char *s,
                              int len);
</pre>
<p>This sets a default handler, but doesn't inhibit the expansion of
internal entity references.  The entity reference will not be passed
to the default handler.</p>

<p>See also <code><a
href="#XML_DefaultCurrent">XML_DefaultCurrent</a></code>.</p>
</div>

<div class="handler">
<pre class="setter" id="XML_SetExternalEntityRefHandler">
void XMLCALL
XML_SetExternalEntityRefHandler(XML_Parser p,
                                XML_ExternalEntityRefHandler hndl)
</pre>
<pre class="signature">
typedef int
(XMLCALL *XML_ExternalEntityRefHandler)(XML_Parser p,
                                        const XML_Char *context,
                                        const XML_Char *base,
                                        const XML_Char *systemId,
                                        const XML_Char *publicId);
</pre>
<p>Set an external entity reference handler. This handler is also
called for processing an external DTD subset if parameter entity parsing
is in effect. (See <a href="#XML_SetParamEntityParsing">
<code>XML_SetParamEntityParsing</code></a>.)</p>

<p>The <code>context</code> parameter specifies the parsing context in
the format expected by the <code>context</code> argument to <code><a
href="#XML_ExternalEntityParserCreate"
>XML_ExternalEntityParserCreate</a></code>.  <code>code</code> is
valid only until the handler returns, so if the referenced entity is
to be parsed later, it must be copied.  <code>context</code> is NULL
only when the entity is a parameter entity, which is how one can
differentiate between general and parameter entities.</p>

<p>The <code>base</code> parameter is the base to use for relative
system identifiers.  It is set by <code><a
href="#XML_SetBase">XML_SetBase</a></code> and may be NULL. The
<code>publicId</code> parameter is the public id given in the entity
declaration and may be NULL.  <code>systemId</code> is the system
identifier specified in the entity declaration and is never NULL.</p>

<p>There are a couple of ways in which this handler differs from
others.  First, this handler returns a status indicator (an
integer). <code>XML_STATUS_OK</code> should be returned for successful
handling of the external entity reference.  Returning
<code>XML_STATUS_ERROR</code> indicates failure, and causes the
calling parser to return an
<code>XML_ERROR_EXTERNAL_ENTITY_HANDLING</code> error.</p>

<p>Second, instead of having the user data as its first argument, it
receives the parser that encountered the entity reference. This, along
with the context parameter, may be used as arguments to a call to
<code><a href= "#XML_ExternalEntityParserCreate"
>XML_ExternalEntityParserCreate</a></code>.  Using the returned
parser, the body of the external entity can be recursively parsed.</p>

<p>Since this handler may be called recursively, it should not be saving
information into global or static variables.</p>
</div>

<pre class="fcndec" id="XML_SetExternalEntityRefHandlerArg">
void XMLCALL
XML_SetExternalEntityRefHandlerArg(XML_Parser p,
                                   void *arg)
</pre>
<div class="fcndef">
<p>Set the argument passed to the ExternalEntityRefHandler.  If
<code>arg</code> is not NULL, it is the new value passed to the
handler set using <code><a href="#XML_SetExternalEntityRefHandler"
>XML_SetExternalEntityRefHandler</a></code>; if <code>arg</code> is
NULL, the argument passed to the handler function will be the parser
object itself.</p>

<p><strong>Note:</strong>
The type of <code>arg</code> and the type of the first argument to the
ExternalEntityRefHandler do not match.  This function takes a
<code>void *</code> to be passed to the handler, while the handler
accepts an <code>XML_Parser</code>.  This is a historical accident,
but will not be corrected before Expat 2.0 (at the earliest) to avoid
causing compiler warnings for code that's known to work with this
API.  It is the responsibility of the application code to know the
actual type of the argument passed to the handler and to manage it
properly.</p>
</div>

<div class="handler">
<pre class="setter" id="XML_SetSkippedEntityHandler">
void XMLCALL
XML_SetSkippedEntityHandler(XML_Parser p,
                            XML_SkippedEntityHandler handler)
</pre>
<pre class="signature">
typedef void
(XMLCALL *XML_SkippedEntityHandler)(void *userData,
                                    const XML_Char *entityName,
                                    int is_parameter_entity);
</pre>
<p>Set a skipped entity handler. This is called in two situations:</p>
<ol>
   <li>An entity reference is encountered for which no declaration
       has been read <em>and</em> this is not an error.</li>
   <li>An internal entity reference is read, but not expanded, because
       <a href="#XML_SetDefaultHandler"><code>XML_SetDefaultHandler</code></a>
	   has been called.</li>
</ol>
<p>The <code>is_parameter_entity</code> argument will be non-zero for
a parameter entity and zero for a general entity.</p> <p>Note: skipped
parameter entities in declarations and skipped general entities in
attribute values cannot be reported, because the event would be out of
sync with the reporting of the declarations or attribute values</p>
</div>

<div class="handler">
<pre class="setter" id="XML_SetUnknownEncodingHandler">
void XMLCALL
XML_SetUnknownEncodingHandler(XML_Parser p,
                              XML_UnknownEncodingHandler enchandler,
			      void *encodingHandlerData)
</pre>
<pre class="signature">
typedef int
(XMLCALL *XML_UnknownEncodingHandler)(void *encodingHandlerData,
                                      const XML_Char *name,
                                      XML_Encoding *info);

typedef struct {
  int map[256];
  void *data;
  int (XMLCALL *convert)(void *data, const char *s);
  void (XMLCALL *release)(void *data);
} XML_Encoding;
</pre>
<p>Set a handler to deal with encodings other than the <a
href="#builtin_encodings">built in set</a>. This should be done before
<code><a href= "#XML_Parse" >XML_Parse</a></code> or <code><a href=
"#XML_ParseBuffer" >XML_ParseBuffer</a></code> have been called on the
given parser.</p> <p>If the handler knows how to deal with an encoding
with the given name, it should fill in the <code>info</code> data
structure and return <code>XML_STATUS_OK</code>. Otherwise it
should return <code>XML_STATUS_ERROR</code>. The handler will be called
at most once per parsed (external) entity. The optional application
data pointer <code>encodingHandlerData</code> will be passed back to
the handler.</p>

<p>The map array contains information for every possible possible leading
byte in a byte sequence. If the corresponding value is &gt;= 0, then it's
a single byte sequence and the byte encodes that Unicode value. If the
value is -1, then that byte is invalid as the initial byte in a sequence.
If the value is -n, where n is an integer &gt; 1, then n is the number of
bytes in the sequence and the actual conversion is accomplished by a
call to the function pointed at by convert. This function may return -1
if the sequence itself is invalid. The convert pointer may be null if
there are only single byte codes. The data parameter passed to the convert
function is the data pointer from <code>XML_Encoding</code>. The
string s is <em>NOT</em> nul-terminated and points at the sequence of
bytes to be converted.</p>

<p>The function pointed at by <code>release</code> is called by the
parser when it is finished with the encoding. It may be NULL.</p>
</div>

<div class="handler">
<pre class="setter" id="XML_SetStartNamespaceDeclHandler">
void XMLCALL
XML_SetStartNamespaceDeclHandler(XML_Parser p,
			         XML_StartNamespaceDeclHandler start);
</pre>
<pre class="signature">
typedef void
(XMLCALL *XML_StartNamespaceDeclHandler)(void *userData,
                                         const XML_Char *prefix,
                                         const XML_Char *uri);
</pre>
<p>Set a handler to be called when a namespace is declared. Namespace
declarations occur inside start tags. But the namespace declaration start
handler is called before the start tag handler for each namespace declared
in that start tag.</p>
</div>

<div class="handler">
<pre class="setter" id="XML_SetEndNamespaceDeclHandler">
void XMLCALL
XML_SetEndNamespaceDeclHandler(XML_Parser p,
			       XML_EndNamespaceDeclHandler end);
</pre>
<pre class="signature">
typedef void
(XMLCALL *XML_EndNamespaceDeclHandler)(void *userData,
                                       const XML_Char *prefix);
</pre>
<p>Set a handler to be called when leaving the scope of a namespace
declaration. This will be called, for each namespace declaration,
after the handler for the end tag of the element in which the
namespace was declared.</p>
</div>

<div class="handler">
<pre class="setter" id="XML_SetNamespaceDeclHandler">
void XMLCALL
XML_SetNamespaceDeclHandler(XML_Parser p,
                            XML_StartNamespaceDeclHandler start,
                            XML_EndNamespaceDeclHandler end)
</pre>
<p>Sets both namespace declaration handlers with a single call.</p>
</div>

<div class="handler">
<pre class="setter" id="XML_SetXmlDeclHandler">
void XMLCALL
XML_SetXmlDeclHandler(XML_Parser p,
		      XML_XmlDeclHandler xmldecl);
</pre>
<pre class="signature">
typedef void
(XMLCALL *XML_XmlDeclHandler)(void            *userData,
                              const XML_Char  *version,
                              const XML_Char  *encoding,
                              int             standalone);
</pre>
<p>Sets a handler that is called for XML declarations and also for
text declarations discovered in exte

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -