You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

227 lines
14 KiB

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
  5. <meta http-equiv="X-UA-Compatible" content="IE=9"/>
  6. <meta name="generator" content="Doxygen 1.8.9.1"/>
  7. <title>Xerces-C++: EntityResolver Class Reference</title>
  8. <link href="tabs.css" rel="stylesheet" type="text/css"/>
  9. <script type="text/javascript" src="jquery.js"></script>
  10. <script type="text/javascript" src="dynsections.js"></script>
  11. <link href="doxygen.css" rel="stylesheet" type="text/css" />
  12. </head>
  13. <body>
  14. <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
  15. <div id="titlearea">
  16. <table cellspacing="0" cellpadding="0">
  17. <tbody>
  18. <tr style="height: 56px;">
  19. <td style="padding-left: 0.5em;">
  20. <div id="projectname">Xerces-C++
  21. &#160;<span id="projectnumber">3.1.2</span>
  22. </div>
  23. </td>
  24. </tr>
  25. </tbody>
  26. </table>
  27. </div>
  28. <!-- end header part -->
  29. <!-- Generated by Doxygen 1.8.9.1 -->
  30. <div id="navrow1" class="tabs">
  31. <ul class="tablist">
  32. <li><a href="index.html"><span>Main&#160;Page</span></a></li>
  33. <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
  34. <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
  35. <li><a href="files.html"><span>Files</span></a></li>
  36. </ul>
  37. </div>
  38. <div id="navrow2" class="tabs2">
  39. <ul class="tablist">
  40. <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
  41. <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
  42. <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
  43. <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
  44. </ul>
  45. </div>
  46. </div><!-- top -->
  47. <div class="header">
  48. <div class="summary">
  49. <a href="classEntityResolver-members.html">List of all members</a> </div>
  50. <div class="headertitle">
  51. <div class="title">EntityResolver Class Reference<span class="mlabels"><span class="mlabel">abstract</span></span></div> </div>
  52. </div><!--header-->
  53. <div class="contents">
  54. <p>Basic interface for resolving entities.
  55. <a href="classEntityResolver.html#details">More...</a></p>
  56. <div class="dynheader">
  57. Inheritance diagram for EntityResolver:</div>
  58. <div class="dyncontent">
  59. <div class="center">
  60. <img src="classEntityResolver.png" usemap="#EntityResolver_map" alt=""/>
  61. <map id="EntityResolver_map" name="EntityResolver_map">
  62. <area href="classDefaultHandler.html" title="Default base class for SAX2 handlers. " alt="DefaultHandler" shape="rect" coords="0,56,97,80"/>
  63. <area href="classHandlerBase.html" title="Default base class for handlers. " alt="HandlerBase" shape="rect" coords="107,56,204,80"/>
  64. </map>
  65. </div></div>
  66. <table class="memberdecls">
  67. <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
  68. Public Member Functions</h2></td></tr>
  69. <tr><td colspan="2"><div class="groupHeader">Constructors and Destructor</div></td></tr>
  70. <tr class="memitem:a14e534eb2170015056ccd71458e1058c"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classEntityResolver.html#a14e534eb2170015056ccd71458e1058c">EntityResolver</a> ()</td></tr>
  71. <tr class="memdesc:a14e534eb2170015056ccd71458e1058c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Default Constructor. <a href="#a14e534eb2170015056ccd71458e1058c">More...</a><br /></td></tr>
  72. <tr class="separator:a14e534eb2170015056ccd71458e1058c"><td class="memSeparator" colspan="2">&#160;</td></tr>
  73. <tr class="memitem:a0d5de369cdaff0d67cfaaa63029187aa"><td class="memItemLeft" align="right" valign="top">virtual&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classEntityResolver.html#a0d5de369cdaff0d67cfaaa63029187aa">~EntityResolver</a> ()</td></tr>
  74. <tr class="memdesc:a0d5de369cdaff0d67cfaaa63029187aa"><td class="mdescLeft">&#160;</td><td class="mdescRight">Destructor. <a href="#a0d5de369cdaff0d67cfaaa63029187aa">More...</a><br /></td></tr>
  75. <tr class="separator:a0d5de369cdaff0d67cfaaa63029187aa"><td class="memSeparator" colspan="2">&#160;</td></tr>
  76. <tr><td colspan="2"><div class="groupHeader">The EntityResolver interface</div></td></tr>
  77. <tr class="memitem:af6e630429ea35de71acda7287846911e"><td class="memItemLeft" align="right" valign="top">virtual <a class="el" href="classInputSource.html">InputSource</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classEntityResolver.html#af6e630429ea35de71acda7287846911e">resolveEntity</a> (const <a class="el" href="Xerces__autoconf__config_8borland_8hpp.html#a8cb107980a360c490ad7661f5d27cc0e">XMLCh</a> *const publicId, const <a class="el" href="Xerces__autoconf__config_8borland_8hpp.html#a8cb107980a360c490ad7661f5d27cc0e">XMLCh</a> *const systemId)=0</td></tr>
  78. <tr class="memdesc:af6e630429ea35de71acda7287846911e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Allow the application to resolve external entities. <a href="#af6e630429ea35de71acda7287846911e">More...</a><br /></td></tr>
  79. <tr class="separator:af6e630429ea35de71acda7287846911e"><td class="memSeparator" colspan="2">&#160;</td></tr>
  80. </table>
  81. <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
  82. <div class="textblock"><p>Basic interface for resolving entities. </p>
  83. <p>If a SAX application needs to implement customized handling for external entities, it must implement this interface and register an instance with the SAX parser using the parser's setEntityResolver method.</p>
  84. <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>
  85. <p>Many SAX 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>
  86. <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>
  87. <p><code> #include &lt;<a class="el" href="EntityResolver_8hpp.html">xercesc/sax/EntityResolver.hpp</a>&gt;<br />
  88. #include &lt;<a class="el" href="InputSource_8hpp.html">xercesc/sax/InputSource.hpp</a>&gt;<br />
  89. <br />
  90. class MyResolver : public <a class="el" href="classEntityResolver.html" title="Basic interface for resolving entities. ">EntityResolver</a> {<br />
  91. public:<br />
  92. &#160; <a class="el" href="classInputSource.html" title="A single input source for an XML entity. ">InputSource</a> resolveEntity (const XMLCh* const publicId, const XMLCh* const systemId);<br />
  93. &#160;&#160; <br />
  94. ...<br />
  95. &#160;&#160; };<br />
  96. &#160; <br />
  97. &#160;MyResolver::resolveEntity {<br />
  98. &#160;&#160;if (<a class="el" href="classXMLString.html#a7ac8e671c8b93126d67ded235174e257" title="Lexicographically compares str1 and str2 and returns a value indicating their relationship. ">XMLString::compareString</a>(systemId, "http://www.myhost.com/today")) {<br />
  99. &#160;&#160;&#160;MyReader* reader = new MyReader();<br />
  100. &#160;&#160;&#160;return new <a class="el" href="classInputSource.html" title="A single input source for an XML entity. ">InputSource(reader)</a>;<br />
  101. &#160;&#160;} else {<br />
  102. &#160;&#160;&#160;return null;<br />
  103. &#160;&#160;}<br />
  104. &#160;}<br />
  105. <br />
  106. </code></p>
  107. <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>
  108. <p>The <a class="el" href="classHandlerBase.html" title="Default base class for handlers. ">HandlerBase</a> 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>
  109. <dl class="section see"><dt>See also</dt><dd><a class="el" href="classParser.html#a62435895e0615380f3017090ac232594" title="Allow an application to register a custom entity resolver. ">Parser::setEntityResolver</a> </dd>
  110. <dd>
  111. <a class="el" href="classInputSource.html#a601a7aa7124e2d8e9664eda9aea6b622" title="Default constructor. ">InputSource::InputSource</a> </dd>
  112. <dd>
  113. <a class="el" href="classHandlerBase.html#aa9bbcdb7958bace9296940ab702ef367">HandlerBase::HandlerBase</a> </dd></dl>
  114. </div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
  115. <a class="anchor" id="a14e534eb2170015056ccd71458e1058c"></a>
  116. <div class="memitem">
  117. <div class="memproto">
  118. <table class="memname">
  119. <tr>
  120. <td class="memname">EntityResolver::EntityResolver </td>
  121. <td>(</td>
  122. <td class="paramname"></td><td>)</td>
  123. <td></td>
  124. </tr>
  125. </table>
  126. </div><div class="memdoc">
  127. <p>Default Constructor. </p>
  128. </div>
  129. </div>
  130. <a class="anchor" id="a0d5de369cdaff0d67cfaaa63029187aa"></a>
  131. <div class="memitem">
  132. <div class="memproto">
  133. <table class="mlabels">
  134. <tr>
  135. <td class="mlabels-left">
  136. <table class="memname">
  137. <tr>
  138. <td class="memname">virtual EntityResolver::~EntityResolver </td>
  139. <td>(</td>
  140. <td class="paramname"></td><td>)</td>
  141. <td></td>
  142. </tr>
  143. </table>
  144. </td>
  145. <td class="mlabels-right">
  146. <span class="mlabels"><span class="mlabel">virtual</span></span> </td>
  147. </tr>
  148. </table>
  149. </div><div class="memdoc">
  150. <p>Destructor. </p>
  151. </div>
  152. </div>
  153. <h2 class="groupheader">Member Function Documentation</h2>
  154. <a class="anchor" id="af6e630429ea35de71acda7287846911e"></a>
  155. <div class="memitem">
  156. <div class="memproto">
  157. <table class="mlabels">
  158. <tr>
  159. <td class="mlabels-left">
  160. <table class="memname">
  161. <tr>
  162. <td class="memname">virtual <a class="el" href="classInputSource.html">InputSource</a>* EntityResolver::resolveEntity </td>
  163. <td>(</td>
  164. <td class="paramtype">const <a class="el" href="Xerces__autoconf__config_8borland_8hpp.html#a8cb107980a360c490ad7661f5d27cc0e">XMLCh</a> *const&#160;</td>
  165. <td class="paramname"><em>publicId</em>, </td>
  166. </tr>
  167. <tr>
  168. <td class="paramkey"></td>
  169. <td></td>
  170. <td class="paramtype">const <a class="el" href="Xerces__autoconf__config_8borland_8hpp.html#a8cb107980a360c490ad7661f5d27cc0e">XMLCh</a> *const&#160;</td>
  171. <td class="paramname"><em>systemId</em>&#160;</td>
  172. </tr>
  173. <tr>
  174. <td></td>
  175. <td>)</td>
  176. <td></td><td></td>
  177. </tr>
  178. </table>
  179. </td>
  180. <td class="mlabels-right">
  181. <span class="mlabels"><span class="mlabel">pure virtual</span></span> </td>
  182. </tr>
  183. </table>
  184. </div><div class="memdoc">
  185. <p>Allow the application to resolve external entities. </p>
  186. <p>The <a class="el" href="classParser.html" title="Basic interface for SAX (Simple API for XML) parsers. ">Parser</a> 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>
  187. <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>
  188. <p>If the system identifier is a URL, the SAX parser must resolve it fully before reporting it to the application.</p>
  189. <dl class="params"><dt>Parameters</dt><dd>
  190. <table class="params">
  191. <tr><td class="paramname">publicId</td><td>The public identifier of the external entity being referenced, or null if none was supplied. </td></tr>
  192. <tr><td class="paramname">systemId</td><td>The system identifier of the external entity being referenced. </td></tr>
  193. </table>
  194. </dd>
  195. </dl>
  196. <dl class="section return"><dt>Returns</dt><dd>An <a class="el" href="classInputSource.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="classInputSource.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>
  197. <dl class="exception"><dt>Exceptions</dt><dd>
  198. <table class="exception">
  199. <tr><td class="paramname"><a class="el" href="classSAXException.html" title="Encapsulate a general SAX error or warning. ">SAXException</a></td><td>Any SAX exception, possibly wrapping another exception. </td></tr>
  200. <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="classInputSource.html" title="A single input source for an XML entity. ">InputSource</a>. </td></tr>
  201. </table>
  202. </dd>
  203. </dl>
  204. <dl class="section see"><dt>See also</dt><dd><a class="el" href="classInputSource.html#a601a7aa7124e2d8e9664eda9aea6b622" title="Default constructor. ">InputSource::InputSource</a> </dd></dl>
  205. <p>Implemented in <a class="el" href="classDefaultHandler.html#a6890d0f8c734eaca9fbc5da987b2b4d4">DefaultHandler</a>, and <a class="el" href="classHandlerBase.html#ac8887abf3674946a8c02bf6097bffd28">HandlerBase</a>.</p>
  206. </div>
  207. </div>
  208. <hr/>The documentation for this class was generated from the following file:<ul>
  209. <li><a class="el" href="EntityResolver_8hpp_source.html">EntityResolver.hpp</a></li>
  210. </ul>
  211. </div><!-- contents -->
  212. <!-- start footer part -->
  213. <hr class="footer"/><address class="footer"><small>
  214. Generated on Wed Mar 18 2015 10:43:38 for Xerces-C++ by &#160;<a href="http://www.doxygen.org/index.html">
  215. <img class="footer" src="doxygen.png" alt="doxygen"/>
  216. </a> 1.8.9.1
  217. </small></address>
  218. </body>
  219. </html>