XQuilla/docs/simple-api/classxercesc_1_1XMLEntityResolver.html
2020-02-17 22:23:16 +01:00

180 lines
12 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>XQilla Simple API Documentation</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<a style="float:right;" href="http://sourceforge.net/projects/xqilla"><img src="http://sflogo.sourceforge.net/sflogo.php?group_id=152021&amp;type=2" border="0" alt="SourceForge.net Logo" /></a>
<!-- Generated by Doxygen 1.6.1 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li><a href="examples.html"><span>Examples</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
<li><a href="classes.html"><span>Class&nbsp;Index</span></a></li>
<li><a href="hierarchy.html"><span>Class&nbsp;Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
</ul>
</div>
<div class="navpath"><a class="el" href="namespacexercesc.html">xercesc</a>::<a class="el" href="classxercesc_1_1XMLEntityResolver.html">XMLEntityResolver</a>
</div>
</div>
<div class="contents">
<h1>xercesc::XMLEntityResolver Class Reference</h1><!-- doxytag: class="xercesc::XMLEntityResolver" -->
<p>Revised interface for resolving entities.
<a href="#_details">More...</a></p>
<p><code>#include &lt;<a class="el" href="XMLEntityResolver_8hpp_source.html">XMLEntityResolver.hpp</a>&gt;</code></p>
<p><a href="classxercesc_1_1XMLEntityResolver-members.html">List of all members.</a></p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td colspan="2"><h2>Public Member Functions</h2></td></tr>
<tr><td colspan="2"><div class="groupHeader">Constructors and Destructor</div></td></tr>
<tr><td colspan="2"><div class="groupText"><p><a class="anchor" id="amgrpfff7c892e0960645e398064e32ab6297"></a> </p>
<br/><br/></div></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classxercesc_1_1XMLEntityResolver.html#a1b0927abdd09757caacf970ac6ff1227">~XMLEntityResolver</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Destructor. <a href="#a1b0927abdd09757caacf970ac6ff1227"></a><br/></td></tr>
<tr><td colspan="2"><div class="groupHeader">The XMLEntityResolver interface</div></td></tr>
<tr><td colspan="2"><div class="groupText"><p><a class="anchor" id="amgrp3e63edd5da50460047d5041721f0ac3a"></a> </p>
<br/><br/></div></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual <a class="el" href="classxercesc_1_1InputSource.html">InputSource</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classxercesc_1_1XMLEntityResolver.html#a59071a14d24f600327e85a99406c8137">resolveEntity</a> (<a class="el" href="classxercesc_1_1XMLResourceIdentifier.html">XMLResourceIdentifier</a> *resourceIdentifier)=0</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Allow the application to resolve external entities. <a href="#a59071a14d24f600327e85a99406c8137"></a><br/></td></tr>
<tr><td colspan="2"><h2>Protected Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classxercesc_1_1XMLEntityResolver.html#a2663910b5939f4bc8cb71cb92a81903b">XMLEntityResolver</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Default Constructor. <a href="#a2663910b5939f4bc8cb71cb92a81903b"></a><br/></td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<p>Revised interface for resolving entities. </p>
<p>If an application needs to implement customized handling for external entities, it can implement this interface and register an instance with the parser using the parser's setXMLEntityResolver method or it can use the basic SAX interface (EntityResolver). The difference between the two interfaces is the arguments to the <a class="el" href="classxercesc_1_1XMLEntityResolver.html#a59071a14d24f600327e85a99406c8137" title="Allow the application to resolve external entities.">resolveEntity()</a> method. With the SAX EntityResolve the arguments are systemId and publicId. With this interface the argument is a <a class="el" href="classxercesc_1_1XMLResourceIdentifier.html">XMLResourceIdentifier</a> object. <em>Only one EntityResolver can be set using setEntityResolver() or setXMLEntityResolver, if both are set the last one set is used.</em></p>
<p>The parser will then allow the application to intercept any external entities (including the external DTD subset and external parameter entities, if any) before including them.</p>
<p>Many applications will not need to implement this interface, but it will be especially useful for applications that build XML documents from databases or other specialised input sources, or for applications that use URI types other than URLs.</p>
<p>The following resolver would provide the application with a special character stream for the entity with the system identifier "http://www.myhost.com/today":</p>
<p><code> #include &lt;<a class="el" href="XMLEntityResolver_8hpp.html">xercesc/util/XMLEntityResolver.hpp</a>&gt;<br/>
#include &lt;<a class="el" href="InputSource_8hpp.html">xercesc/sax/InputSource.hpp</a>&gt;<br/>
<br/>
&nbsp;class MyResolver : public <a class="el" href="classxercesc_1_1XMLEntityResolver.html" title="Revised interface for resolving entities.">XMLEntityResolver</a> {<br/>
&nbsp;&nbsp;public:<br/>
&nbsp;&nbsp;&nbsp;<a class="el" href="classxercesc_1_1InputSource.html" title="A single input source for an XML entity.">InputSource</a> resolveEntity (XMLResourceIdentifier* xmlri);<br/>
&nbsp;&nbsp;&nbsp;...<br/>
&nbsp;&nbsp;};<br/>
<br/>
&nbsp;MyResolver::resolveEntity(XMLResourceIdentifier* xmlri) {<br/>
&nbsp;&nbsp;switch(xmlri-&gt;getResourceIdentifierType()) {<br/>
&nbsp;&nbsp;&nbsp;case XMLResourceIdentifier::SystemId:<br/>
&nbsp;&nbsp;&nbsp;&nbsp;if (XMLString::compareString(xmlri-&gt;getSystemId(), "http://www.myhost.com/today")) {<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MyReader* reader = new MyReader();<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return new InputSource(reader);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;} else {<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return null;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;}<br/>
&nbsp;&nbsp;&nbsp;&nbsp;break;<br/>
&nbsp;&nbsp;&nbsp;default:<br/>
&nbsp;&nbsp;&nbsp;&nbsp;return null;<br/>
&nbsp;&nbsp;}<br/>
&nbsp;}</code></p>
<p>The application can also use this interface to redirect system identifiers to local URIs or to look up replacements in a catalog (possibly by using the public identifier).</p>
<p>The HandlerBase class implements the default behaviour for this interface, which is simply always to return null (to request that the parser use the default system identifier).</p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="classxercesc_1_1XMLResourceIdentifier.html">XMLResourceIdentifier</a> </dd>
<dd>
Parser::setXMLEntityResolver </dd>
<dd>
<a class="el" href="classxercesc_1_1InputSource.html#aa8a03426e60c7fea417ca87fe92cdbfe" title="Default constructor.">InputSource::InputSource</a> </dd>
<dd>
HandlerBase::HandlerBase </dd></dl>
<hr/><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="a1b0927abdd09757caacf970ac6ff1227"></a><!-- doxytag: member="xercesc::XMLEntityResolver::~XMLEntityResolver" ref="a1b0927abdd09757caacf970ac6ff1227" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">virtual xercesc::XMLEntityResolver::~XMLEntityResolver </td>
<td>(</td>
<td class="paramname"></td>
<td>&nbsp;)&nbsp;</td>
<td><code> [inline, virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Destructor. </p>
</div>
</div>
<a class="anchor" id="a2663910b5939f4bc8cb71cb92a81903b"></a><!-- doxytag: member="xercesc::XMLEntityResolver::XMLEntityResolver" ref="a2663910b5939f4bc8cb71cb92a81903b" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">xercesc::XMLEntityResolver::XMLEntityResolver </td>
<td>(</td>
<td class="paramname"></td>
<td>&nbsp;)&nbsp;</td>
<td><code> [inline, protected]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Default Constructor. </p>
</div>
</div>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="a59071a14d24f600327e85a99406c8137"></a><!-- doxytag: member="xercesc::XMLEntityResolver::resolveEntity" ref="a59071a14d24f600327e85a99406c8137" args="(XMLResourceIdentifier *resourceIdentifier)=0" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">virtual <a class="el" href="classxercesc_1_1InputSource.html">InputSource</a>* xercesc::XMLEntityResolver::resolveEntity </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classxercesc_1_1XMLResourceIdentifier.html">XMLResourceIdentifier</a> *&nbsp;</td>
<td class="paramname"> <em>resourceIdentifier</em></td>
<td>&nbsp;)&nbsp;</td>
<td><code> [pure virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Allow the application to resolve external entities. </p>
<p>The Parser will call this method before opening any external entity except the top-level document entity (including the external DTD subset, external entities referenced within the DTD, and external entities referenced within the document element): the application may request that the parser resolve the entity itself, that it use an alternative URI, or that it use an entirely different input source.</p>
<p>Application writers can use this method to redirect external system identifiers to secure and/or local URIs, to look up public identifiers in a catalogue, or to read an entity from a database or other input source (including, for example, a dialog box).</p>
<p>If the system identifier is a URL, the SAX parser must resolve it fully before reporting it to the application.</p>
<dl><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>resourceIdentifier</em>&nbsp;</td><td>An object containing the type of resource to be resolved and the associated data members corresponding to this type. </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>An <a class="el" href="classxercesc_1_1InputSource.html" title="A single input source for an XML entity.">InputSource</a> object describing the new input source, or null to request that the parser open a regular URI connection to the system identifier. The returned <a class="el" href="classxercesc_1_1InputSource.html" title="A single input source for an XML entity.">InputSource</a> is owned by the parser which is responsible to clean up the memory. </dd></dl>
<dl><dt><b>Exceptions:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>SAXException</em>&nbsp;</td><td>Any SAX exception, possibly wrapping another exception. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>IOException</em>&nbsp;</td><td>An IO exception, possibly the result of creating a new InputStream or Reader for the <a class="el" href="classxercesc_1_1InputSource.html" title="A single input source for an XML entity.">InputSource</a>.</td></tr>
</table>
</dd>
</dl>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="classxercesc_1_1InputSource.html#aa8a03426e60c7fea417ca87fe92cdbfe" title="Default constructor.">InputSource::InputSource</a> </dd>
<dd>
<a class="el" href="classxercesc_1_1XMLResourceIdentifier.html">XMLResourceIdentifier</a> </dd></dl>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="XMLEntityResolver_8hpp_source.html">XMLEntityResolver.hpp</a></li>
</ul>
</div>
<hr size="1"/><address style="text-align: right;"><small>Generated on 18 May 2015 for XQilla Simple API by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.1 </small></address>
</body>
</html>