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

209 lines
13 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.8.5 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;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 id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class&#160;List</span></a></li>
<li><a href="classes.html"><span>Class&#160;Index</span></a></li>
<li><a href="inherits.html"><span>Class&#160;Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class&#160;Members</span></a></li>
</ul>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="namespacexercesc.html">xercesc</a></li><li class="navelem"><a class="el" href="classxercesc_1_1XMLEntityResolver.html">XMLEntityResolver</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pro-methods">Protected Member Functions</a> &#124;
<a href="classxercesc_1_1XMLEntityResolver-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">xercesc::XMLEntityResolver Class Reference<span class="mlabels"><span class="mlabel">abstract</span></span></div> </div>
</div><!--header-->
<div class="contents">
<p>Revised interface for resolving entities.
<a href="classxercesc_1_1XMLEntityResolver.html#details">More...</a></p>
<p><code>#include &lt;<a class="el" href="XMLEntityResolver_8hpp_source.html">XMLEntityResolver.hpp</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr><td colspan="2"><div class="groupHeader">Constructors and Destructor</div></td></tr>
<tr class="memitem:a1b0927abdd09757caacf970ac6ff1227"><td class="memItemLeft" align="right" valign="top">virtual&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classxercesc_1_1XMLEntityResolver.html#a1b0927abdd09757caacf970ac6ff1227">~XMLEntityResolver</a> ()</td></tr>
<tr class="memdesc:a1b0927abdd09757caacf970ac6ff1227"><td class="mdescLeft">&#160;</td><td class="mdescRight">Destructor. <a href="#a1b0927abdd09757caacf970ac6ff1227">More...</a><br/></td></tr>
<tr class="separator:a1b0927abdd09757caacf970ac6ff1227"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr><td colspan="2"><div class="groupHeader">The XMLEntityResolver interface</div></td></tr>
<tr class="memitem:a59071a14d24f600327e85a99406c8137"><td class="memItemLeft" align="right" valign="top">virtual <a class="el" href="classxercesc_1_1InputSource.html">InputSource</a> *&#160;</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 class="memdesc:a59071a14d24f600327e85a99406c8137"><td class="mdescLeft">&#160;</td><td class="mdescRight">Allow the application to resolve external entities. <a href="#a59071a14d24f600327e85a99406c8137">More...</a><br/></td></tr>
<tr class="separator:a59071a14d24f600327e85a99406c8137"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-methods"></a>
Protected Member Functions</h2></td></tr>
<tr class="memitem:a2663910b5939f4bc8cb71cb92a81903b"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classxercesc_1_1XMLEntityResolver.html#a2663910b5939f4bc8cb71cb92a81903b">XMLEntityResolver</a> ()</td></tr>
<tr class="memdesc:a2663910b5939f4bc8cb71cb92a81903b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Default Constructor. <a href="#a2663910b5939f4bc8cb71cb92a81903b">More...</a><br/></td></tr>
<tr class="separator:a2663910b5939f4bc8cb71cb92a81903b"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><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/>
&#160;class MyResolver : public <a class="el" href="classxercesc_1_1XMLEntityResolver.html" title="Revised interface for resolving entities. ">XMLEntityResolver</a> {<br/>
&#160;&#160;public:<br/>
&#160;&#160;&#160;InputSource* resolveEntity (XMLResourceIdentifier* xmlri);<br/>
&#160;&#160;&#160;...<br/>
&#160;&#160;};<br/>
<br/>
&#160;MyResolver::resolveEntity(XMLResourceIdentifier* xmlri) {<br/>
&#160;&#160;switch(xmlri-&gt;getResourceIdentifierType()) {<br/>
&#160;&#160;&#160;case XMLResourceIdentifier::SystemId:<br/>
&#160;&#160;&#160;&#160;if (XMLString::compareString(xmlri-&gt;getSystemId(), "http://www.myhost.com/today")) {<br/>
&#160;&#160;&#160;&#160;&#160;MyReader* reader = new MyReader();<br/>
&#160;&#160;&#160;&#160;&#160;return new InputSource(reader);<br/>
&#160;&#160;&#160;&#160;} else {<br/>
&#160;&#160;&#160;&#160;&#160;return null;<br/>
&#160;&#160;&#160;&#160;}<br/>
&#160;&#160;&#160;&#160;break;<br/>
&#160;&#160;&#160;default:<br/>
&#160;&#160;&#160;&#160;return null;<br/>
&#160;&#160;}<br/>
&#160;}</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="section see"><dt>See Also</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>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="a1b0927abdd09757caacf970ac6ff1227"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual xercesc::XMLEntityResolver::~XMLEntityResolver </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Destructor. </p>
</div>
</div>
<a class="anchor" id="a2663910b5939f4bc8cb71cb92a81903b"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">xercesc::XMLEntityResolver::XMLEntityResolver </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">protected</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Default Constructor. </p>
</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="a59071a14d24f600327e85a99406c8137"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<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> *&#160;</td>
<td class="paramname"><em>resourceIdentifier</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span> </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 class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">resourceIdentifier</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="section return"><dt>Returns</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 class="exception"><dt>Exceptions</dt><dd>
<table class="exception">
<tr><td class="paramname">SAXException</td><td>Any SAX exception, possibly wrapping another exception. </td></tr>
<tr><td class="paramname">IOException</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="section see"><dt>See Also</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><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.5
</small></address>
</body>
</html>