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.

580 lines
30 KiB

  1. <?xml version="1.0" standalone="no"?>
  2. <!--
  3. * Licensed to the Apache Software Foundation (ASF) under one or more
  4. * contributor license agreements. See the NOTICE file distributed with
  5. * this work for additional information regarding copyright ownership.
  6. * The ASF licenses this file to You under the Apache License, Version 2.0
  7. * (the "License"); you may not use this file except in compliance with
  8. * the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. -->
  18. <!DOCTYPE s1 SYSTEM "sbk:/style/dtd/document.dtd">
  19. <s1 title="SAX Programming Guide">
  20. <anchor name="UsingSAX1API"/>
  21. <s2 title="Using the SAX API">
  22. <p>The SAX API for XML parsers was originally developed for
  23. Java. Please be aware that there is no standard SAX API for
  24. C++, and that use of the &XercesCName; SAX API does not
  25. guarantee client code compatibility with other C++ XML
  26. parsers.</p>
  27. <p>The SAX API presents a callback based API to the parser. An
  28. application that uses SAX provides an instance of a handler
  29. class to the parser. When the parser detects XML constructs,
  30. it calls the methods of the handler class, passing them
  31. information about the construct that was detected. The most
  32. commonly used handler classes are DocumentHandler which is
  33. called when XML constructs are recognized, and ErrorHandler
  34. which is called when an error occurs. The header files for the
  35. various SAX handler classes are in the <code>xercesc/sax/</code>
  36. directory.</p>
  37. <p>As a convenience, &XercesCName; provides
  38. HandlerBase, a single class which is publicly derived
  39. from all the Handler classes. HandlerBase's default
  40. implementation of the handler callback methods is to do
  41. nothing. A convenient way to get started with &XercesCName; is
  42. to derive your own handler class from HandlerBase and override
  43. just those methods in HandlerBase which you are interested in
  44. customizing. This simple example shows how to create a handler
  45. which will print element names, and print fatal error
  46. messages. The source code for the sample applications show
  47. additional examples of how to write handler classes.</p>
  48. <p>This is the header file MySAXHandler.hpp:</p>
  49. <source>#include &lt;xercesc/sax/HandlerBase.hpp>
  50. class MySAXHandler : public HandlerBase {
  51. public:
  52. void startElement(const XMLCh* const, AttributeList&amp;);
  53. void fatalError(const SAXParseException&amp;);
  54. };</source>
  55. <p>This is the implementation file MySAXHandler.cpp:</p>
  56. <source>#include "MySAXHandler.hpp"
  57. #include &lt;iostream>
  58. using namespace std;
  59. MySAXHandler::MySAXHandler()
  60. {
  61. }
  62. void MySAXHandler::startElement(const XMLCh* const name,
  63. AttributeList&amp; attributes)
  64. {
  65. char* message = XMLString::transcode(name);
  66. cout &lt;&lt; "I saw element: "&lt;&lt; message &lt;&lt; endl;
  67. XMLString::release(&amp;message);
  68. }
  69. void MySAXHandler::fatalError(const SAXParseException&amp; exception)
  70. {
  71. char* message = XMLString::transcode(exception.getMessage());
  72. cout &lt;&lt; "Fatal Error: " &lt;&lt; message
  73. &lt;&lt; " at line: " &lt;&lt; exception.getLineNumber()
  74. &lt;&lt; endl;
  75. XMLString::release(&amp;message);
  76. }</source>
  77. <p>The XMLCh and AttributeList types are supplied by
  78. &XercesCName; and are documented in the API reference.
  79. Examples of their usage appear in the source code for
  80. the sample applications.</p>
  81. </s2>
  82. <anchor name="SAXParser"/>
  83. <s2 title="SAXParser">
  84. <anchor name="ConstructParser"/>
  85. <s3 title="Constructing a SAXParser">
  86. <p>In order to use &XercesCName; SAX to parse XML files, you will
  87. need to create an instance of the SAXParser class. The example
  88. below shows the code you need in order to create an instance
  89. of SAXParser. The DocumentHandler and ErrorHandler instances
  90. required by the SAX API are provided using the HandlerBase
  91. class supplied with &XercesCName;.</p>
  92. <source>
  93. #include &lt;xercesc/parsers/SAXParser.hpp>
  94. #include &lt;xercesc/sax/HandlerBase.hpp>
  95. #include &lt;xercesc/util/XMLString.hpp>
  96. #include &lt;iostream>
  97. using namespace std;
  98. using namespace xercesc;
  99. int main (int argc, char* args[]) {
  100. try {
  101. XMLPlatformUtils::Initialize();
  102. }
  103. catch (const XMLException&amp; toCatch) {
  104. char* message = XMLString::transcode(toCatch.getMessage());
  105. cout &lt;&lt; "Error during initialization! :\n"
  106. &lt;&lt; message &lt;&lt; "\n";
  107. XMLString::release(&amp;message);
  108. return 1;
  109. }
  110. char* xmlFile = "x1.xml";
  111. SAXParser* parser = new SAXParser();
  112. parser->setDoValidation(true);
  113. parser->setDoNamespaces(true); // optional
  114. DocumentHandler* docHandler = new HandlerBase();
  115. ErrorHandler* errHandler = (ErrorHandler*) docHandler;
  116. parser->setDocumentHandler(docHandler);
  117. parser->setErrorHandler(errHandler);
  118. try {
  119. parser->parse(xmlFile);
  120. }
  121. catch (const XMLException&amp; toCatch) {
  122. char* message = XMLString::transcode(toCatch.getMessage());
  123. cout &lt;&lt; "Exception message is: \n"
  124. &lt;&lt; message &lt;&lt; "\n";
  125. XMLString::release(&amp;message);
  126. return -1;
  127. }
  128. catch (const SAXParseException&amp; toCatch) {
  129. char* message = XMLString::transcode(toCatch.getMessage());
  130. cout &lt;&lt; "Exception message is: \n"
  131. &lt;&lt; message &lt;&lt; "\n";
  132. XMLString::release(&amp;message);
  133. return -1;
  134. }
  135. catch (...) {
  136. cout &lt;&lt; "Unexpected Exception \n" ;
  137. return -1;
  138. }
  139. delete parser;
  140. delete docHandler;
  141. return 0;
  142. }</source>
  143. </s3>
  144. <anchor name="SAXFeatures"/>
  145. <s3 title="SAXParser Supported Features">
  146. <p>The behavior of the SAXParser is dependant on the values of the following features. All
  147. of the features below are set using the "setter" methods (e.g. <code>setDoNamespaces</code>),
  148. and are queried using the corresponding "getter" methods (e.g. <code>getDoNamespaces</code>).
  149. The following only gives you a quick summary of supported features. Please
  150. refer to <jump href="api-&XercesC3Series;.html">API Documentation</jump> for complete detail.
  151. </p>
  152. <p>None of these features can be modified in the middle of a parse, or an exception will be thrown.</p>
  153. <anchor name="namespaces"/>
  154. <table>
  155. <tr><th colspan="2"><em>void setDoNamespaces(const bool)</em></th></tr>
  156. <tr><th><em>true:</em></th><td> Perform Namespace processing. </td></tr>
  157. <tr><th><em>false:</em></th><td> Do not perform Namespace processing. </td></tr>
  158. <tr><th><em>default:</em></th><td> false </td></tr>
  159. <tr><th><em>note:</em></th><td> If the validation scheme is set to Val_Always or Val_Auto, then the
  160. document must contain a grammar that supports the use of namespaces. </td></tr>
  161. <tr><th><em>see:</em></th><td>
  162. <link anchor="validation-dynamic">setValidationScheme</link>
  163. </td></tr>
  164. </table>
  165. <p/>
  166. <anchor name="validation-dynamic"/>
  167. <table>
  168. <tr><th colspan="2"><em>void setValidationScheme(const ValSchemes)</em></th></tr>
  169. <tr><th><em>Val_Auto:</em></th><td> The parser will report validation errors only if a grammar is specified. </td></tr>
  170. <tr><th><em>Val_Always:</em></th><td> The parser will always report validation errors. </td></tr>
  171. <tr><th><em>Val_Never:</em></th><td> Do not report validation errors. </td></tr>
  172. <tr><th><em>default:</em></th><td> Val_Never </td></tr>
  173. <tr><th><em>note:</em></th><td> If set to Val_Always, the document must
  174. specify a grammar. If this feature is set to Val_Never and document specifies a grammar,
  175. that grammar might be parsed but no validation of the document contents will be
  176. performed. </td></tr>
  177. <tr><th><em>see:</em></th><td>
  178. <link anchor="load-external-dtd">setLoadExternalDTD</link>
  179. </td></tr>
  180. </table>
  181. <p/>
  182. <anchor name="schema"/>
  183. <table>
  184. <tr><th colspan="2"><em>void setDoSchema(const bool)</em></th></tr>
  185. <tr><th><em>true:</em></th><td> Enable the parser's schema support. </td></tr>
  186. <tr><th><em>false:</em></th><td> Disable the parser's schema support. </td></tr>
  187. <tr><th><em>default:</em></th><td> false </td></tr>
  188. <tr><th><em>note</em></th><td> If set to true, namespace processing must also be turned on. </td></tr>
  189. <tr><th><em>see:</em></th><td>
  190. <link anchor="namespaces">setDoNamespaces</link>
  191. </td></tr>
  192. </table>
  193. <p/>
  194. <table>
  195. <tr><th colspan="2"><em>void setValidationSchemaFullChecking(const bool)</em></th></tr>
  196. <tr><th><em>true:</em></th><td> Enable full schema constraint checking, including checking
  197. which may be time-consuming or memory intensive. Currently, particle unique
  198. attribution constraint checking and particle derivation restriction checking
  199. are controlled by this option. </td></tr>
  200. <tr><th><em>false:</em></th><td> Disable full schema constraint checking. </td></tr>
  201. <tr><th><em>default:</em></th><td> false </td></tr>
  202. <tr><th><em>note:</em></th><td> This feature checks the Schema grammar itself for
  203. additional errors that are time-consuming or memory intensive. It does <em>not</em> affect the
  204. level of checking performed on document instances that use Schema grammars. </td></tr>
  205. <tr><th><em>see:</em></th><td>
  206. <link anchor="schema">setDoSchema</link>
  207. </td></tr>
  208. </table>
  209. <p/>
  210. <anchor name="load-schema"/>
  211. <table>
  212. <tr><th colspan="2"><em>void setLoadSchema(const bool)</em></th></tr>
  213. <tr><th><em>true:</em></th><td> Load the schema. </td></tr>
  214. <tr><th><em>false:</em></th><td> Don't load the schema if it wasn't found in the grammar pool. </td></tr>
  215. <tr><th><em>default:</em></th><td> true </td></tr>
  216. <tr><th><em>note:</em></th><td> This feature is ignored and no schemas are loaded if schema processing is disabled. </td></tr>
  217. <tr><th><em>see:</em></th><td>
  218. <link anchor="schema">setDoSchema</link>
  219. </td></tr>
  220. </table>
  221. <p/>
  222. <anchor name="load-external-dtd"/>
  223. <table>
  224. <tr><th colspan="2"><em>void setLoadExternalDTD(const bool)</em></th></tr>
  225. <tr><th><em>true:</em></th><td> Load the External DTD. </td></tr>
  226. <tr><th><em>false:</em></th><td> Ignore the external DTD completely. </td></tr>
  227. <tr><th><em>default:</em></th><td> true </td></tr>
  228. <tr><th><em>note</em></th><td> This feature is ignored and DTD is always loaded
  229. if the validation scheme is set to Val_Always or Val_Auto. </td></tr>
  230. <tr><th><em>see:</em></th><td>
  231. <link anchor="validation-dynamic">setValidationScheme</link>
  232. </td></tr>
  233. </table>
  234. <p/>
  235. <anchor name="continue-after-fatal"/>
  236. <table>
  237. <tr><th colspan="2"><em>void setExitOnFirstFatalError(const bool)</em></th></tr>
  238. <tr><th><em>true:</em></th><td> Stops parse on first fatal error. </td></tr>
  239. <tr><th><em>false:</em></th><td> Attempt to continue parsing after a fatal error. </td></tr>
  240. <tr><th><em>default:</em></th><td> true </td></tr>
  241. <tr><th><em>note:</em></th><td> The behavior of the parser when this feature is set to
  242. false is <em>undetermined</em>! Therefore use this feature with extreme caution because
  243. the parser may get stuck in an infinite loop or worse. </td></tr>
  244. </table>
  245. <p/>
  246. <table>
  247. <tr><th colspan="2"><em>void setValidationConstraintFatal(const bool)</em></th></tr>
  248. <tr><th><em>true:</em></th><td> The parser will treat validation error as fatal and will
  249. exit depends on the state of
  250. <link anchor="continue-after-fatal">setExitOnFirstFatalError</link>.
  251. </td></tr>
  252. <tr><th><em>false:</em></th><td> The parser will report the error and continue processing. </td></tr>
  253. <tr><th><em>default:</em></th><td> false </td></tr>
  254. <tr><th><em>note:</em></th><td> Setting this true does not mean the validation error will
  255. be printed with the word "Fatal Error". It is still printed as "Error", but the parser
  256. will exit if
  257. <link anchor="continue-after-fatal">setExitOnFirstFatalError</link>
  258. is set to true. </td></tr>
  259. <tr><th><em>see:</em></th><td>
  260. <link anchor="continue-after-fatal">setExitOnFirstFatalError</link>
  261. </td></tr>
  262. </table>
  263. <p/>
  264. <anchor name="use-cached"/>
  265. <table>
  266. <tr><th colspan="2"><em>void useCachedGrammarInParse(const bool)</em></th></tr>
  267. <tr><th><em>true:</em></th><td>Use cached grammar if it exists in the pool.</td></tr>
  268. <tr><th><em>false:</em></th><td>Parse the schema grammar.</td></tr>
  269. <tr><th><em>default:</em></th><td> false </td></tr>
  270. <tr><th><em>note:</em></th><td>The getter function for this method is called isUsingCachedGrammarInParse.</td></tr>
  271. <tr><th><em>note:</em></th><td>If the grammar caching option is enabled, this option is set to true automatically
  272. and any setting to this option by the user is a no-op.</td></tr>
  273. <tr><th><em>see:</em></th><td>
  274. <link anchor="cache-grammar">cacheGrammarFromParse</link>
  275. </td></tr>
  276. </table>
  277. <p/>
  278. <anchor name="cache-grammar"/>
  279. <table>
  280. <tr><th colspan="2"><em>void cacheGrammarFromParse(const bool)</em></th></tr>
  281. <tr><th><em>true:</em></th><td>Cache the grammar in the pool for re-use in subsequent parses.</td></tr>
  282. <tr><th><em>false:</em></th><td>Do not cache the grammar in the pool</td></tr>
  283. <tr><th><em>default:</em></th><td> false </td></tr>
  284. <tr><th><em>note:</em></th><td>The getter function for this method is called isCachingGrammarFromParse</td></tr>
  285. <tr><th><em>note:</em></th><td> If set to true, the useCachedGrammarInParse
  286. is also set to true automatically.</td></tr>
  287. <tr><th><em>see:</em></th><td>
  288. <link anchor="use-cached">useCachedGrammarInParse</link>
  289. </td></tr>
  290. </table>
  291. <p/>
  292. <anchor name="StandardUriConformant"/>
  293. <table>
  294. <tr><th colspan="2"><em>void setStandardUriConformant(const bool)</em></th></tr>
  295. <tr><th><em>true:</em></th><td> Force standard uri conformance. </td></tr>
  296. <tr><th><em>false:</em></th><td> Do not force standard uri conformance. </td></tr>
  297. <tr><th><em>default:</em></th><td> false </td></tr>
  298. <tr><th><em>note:</em></th><td> If set to true, malformed uri will be rejected
  299. and fatal error will be issued. </td></tr>
  300. </table>
  301. <p/>
  302. <anchor name="CalculateSrcOffset"/>
  303. <table>
  304. <tr><th colspan="2"><em>void setCalculateSrcOfs(const bool)</em></th></tr>
  305. <tr><th><em>true:</em></th><td> Enable src offset calculation. </td></tr>
  306. <tr><th><em>false:</em></th><td> Disable src offset calculation. </td></tr>
  307. <tr><th><em>default:</em></th><td> false </td></tr>
  308. <tr><th><em>note:</em></th><td> If set to true, the user can inquire about
  309. the current src offset within the input source. Setting it to false (default)
  310. improves the performance.</td></tr>
  311. </table>
  312. <p/>
  313. <anchor name="IdentityConstraintChecking"/>
  314. <table>
  315. <tr><th colspan="2"><em>void setIdentityConstraintChecking(const bool);</em></th></tr>
  316. <tr><th><em>true:</em></th><td> Enable identity constraint checking. </td></tr>
  317. <tr><th><em>false:</em></th><td> Disable identity constraint checking. </td></tr>
  318. <tr><th><em>default:</em></th><td> true </td></tr>
  319. </table>
  320. <p/>
  321. <anchor name="GenerateSyntheticAnnotations"/>
  322. <table>
  323. <tr><th colspan="2"><em>void setGenerateSyntheticAnnotations(const bool);</em></th></tr>
  324. <tr><th><em>true:</em></th><td> Enable generation of synthetic annotations. A synthetic annotation will be
  325. generated when a schema component has non-schema attributes but no child annotation. </td></tr>
  326. <tr><th><em>false:</em></th><td> Disable generation of synthetic annotations. </td></tr>
  327. <tr><th><em>default:</em></th><td> false </td></tr>
  328. </table>
  329. <p/>
  330. <anchor name="XercesValidateAnnotations"/>
  331. <table>
  332. <tr><th colspan="2"><em>setValidateAnnotation</em></th></tr>
  333. <tr><th><em>true:</em></th><td> Enable validation of annotations. </td></tr>
  334. <tr><th><em>false:</em></th><td> Disable validation of annotations. </td></tr>
  335. <tr><th><em>default:</em></th><td> false </td></tr>
  336. <tr><th><em>note:</em></th><td> Each annotation is validated independently. </td></tr>
  337. </table>
  338. <p/>
  339. <anchor name="IgnoreAnnotations"/>
  340. <table>
  341. <tr><th colspan="2"><em>setIgnoreAnnotations</em></th></tr>
  342. <tr><th><em>true:</em></th><td> Do not generate XSAnnotations when traversing a schema.</td></tr>
  343. <tr><th><em>false:</em></th><td> Generate XSAnnotations when traversing a schema.</td></tr>
  344. <tr><th><em>default:</em></th><td> false </td></tr>
  345. </table>
  346. <p/>
  347. <anchor name="DisableDefaultEntityResolution"/>
  348. <table>
  349. <tr><th colspan="2"><em>setDisableDefaultEntityResolution</em></th></tr>
  350. <tr><th><em>true:</em></th><td> The parser will not attempt to resolve the entity when the resolveEntity method returns NULL.</td></tr>
  351. <tr><th><em>false:</em></th><td> The parser will attempt to resolve the entity when the resolveEntity method returns NULL.</td></tr>
  352. <tr><th><em>default:</em></th><td> false </td></tr>
  353. </table>
  354. <p/>
  355. <anchor name="SkipDTDValidation"/>
  356. <table>
  357. <tr><th colspan="2"><em>setSkipDTDValidation</em></th></tr>
  358. <tr><th><em>true:</em></th><td> When schema validation is on the parser will ignore the DTD, except for entities.</td></tr>
  359. <tr><th><em>false:</em></th><td> The parser will not ignore DTDs when validating.</td></tr>
  360. <tr><th><em>default:</em></th><td> false </td></tr>
  361. <tr><th><em>see:</em></th><td>
  362. <link anchor="schema">DoSchema</link></td></tr>
  363. </table>
  364. <p/>
  365. <anchor name="XercesIgnoreCachedDTD"/>
  366. <table>
  367. <tr><th colspan="2"><em>setIgnoreCachedDTD</em></th></tr>
  368. <tr><th><em>true:</em></th><td> Ignore a cached DTD when an XML document contains both an
  369. internal and external DTD, and the use cached grammar from parse option
  370. is enabled. Currently, we do not allow using cached DTD grammar when an
  371. internal subset is present in the document. This option will only affect
  372. the behavior of the parser when an internal and external DTD both exist
  373. in a document (i.e. no effect if document has no internal subset).</td></tr>
  374. <tr><th><em>false:</em></th><td> Don't ignore cached DTD. </td></tr>
  375. <tr><th><em>default:</em></th><td> false </td></tr>
  376. <tr><th><em>see:</em></th><td>
  377. <link anchor="use-cached">useCachedGrammarInParse</link></td></tr>
  378. </table>
  379. <p/>
  380. <anchor name="XercesHandleMultipleImports"/>
  381. <table>
  382. <tr><th colspan="2"><em>setHandleMultipleImports</em></th></tr>
  383. <tr><th><em>true:</em></th><td> During schema validation allow multiple schemas with the same namespace
  384. to be imported.</td></tr>
  385. <tr><th><em>false:</em></th><td> Don't import multiple schemas with the same namespace. </td></tr>
  386. <tr><th><em>default:</em></th><td> false </td></tr>
  387. </table>
  388. <p/>
  389. <table>
  390. <tr><th colspan="2"><em>void setExternalSchemaLocation(const XMLCh* const)</em></th></tr>
  391. <tr><th><em>Description</em></th><td> The XML Schema Recommendation explicitly states that
  392. the inclusion of schemaLocation/ noNamespaceSchemaLocation attributes in the
  393. instance document is only a hint; it does not mandate that these attributes
  394. must be used to locate schemas. Similar situation happens to &lt;import&gt;
  395. element in schema documents. This property allows the user to specify a list
  396. of schemas to use. If the targetNamespace of a schema specified using this
  397. method matches the targetNamespace of a schema occurring in the instance
  398. document in schemaLocation attribute, or
  399. if the targetNamespace matches the namespace attribute of &lt;import&gt;
  400. element, the schema specified by the user using this property will
  401. be used (i.e., the schemaLocation attribute in the instance document
  402. or on the &lt;import&gt; element will be effectively ignored). </td></tr>
  403. <tr><th><em>Value</em></th><td> The syntax is the same as for schemaLocation attributes
  404. in instance documents: e.g, "http://www.example.com file_name.xsd".
  405. The user can specify more than one XML Schema in the list. </td></tr>
  406. <tr><th><em>Value Type</em></th><td> XMLCh* </td></tr>
  407. </table>
  408. <p/>
  409. <table>
  410. <tr><th colspan="2"><em>void setExternalNoNamespaceSchemaLocation(const XMLCh* const)</em></th></tr>
  411. <tr><th><em>Description</em></th><td> The XML Schema Recommendation explicitly states that
  412. the inclusion of schemaLocation/ noNamespaceSchemaLocation attributes in the
  413. instance document is only a hint; it does not mandate that these attributes
  414. must be used to locate schemas. This property allows the user to specify the
  415. no target namespace XML Schema Location externally. If specified, the instance
  416. document's noNamespaceSchemaLocation attribute will be effectively ignored. </td></tr>
  417. <tr><th><em>Value</em></th><td> The syntax is the same as for the noNamespaceSchemaLocation
  418. attribute that may occur in an instance document: e.g."file_name.xsd". </td></tr>
  419. <tr><th><em>Value Type</em></th><td> XMLCh* </td></tr>
  420. </table>
  421. <p/>
  422. <table>
  423. <tr><th colspan="2"><em>void useScanner(const XMLCh* const)</em></th></tr>
  424. <tr><th><em>Description</em></th><td> This property allows the user to specify the name of
  425. the XMLScanner to use for scanning XML documents. If not specified, the default
  426. scanner "IGXMLScanner" is used.</td></tr>
  427. <tr><th><em>Value</em></th><td> The recognized scanner names are: <br/>
  428. 1."WFXMLScanner" - scanner that performs well-formedness checking only.<br/>
  429. 2. "DGXMLScanner" - scanner that handles XML documents with DTD grammar information.<br/>
  430. 3. "SGXMLScanner" - scanner that handles XML documents with XML schema grammar information.<br/>
  431. 4. "IGXMLScanner" - scanner that handles XML documents with DTD or/and XML schema grammar information.<br/>
  432. Users can use the predefined constants defined in XMLUni directly (fgWFXMLScanner, fgDGXMLScanner,
  433. fgSGXMLScanner, or fgIGXMLScanner) or a string that matches the value of one of those constants.</td></tr>
  434. <tr><th><em>Value Type</em></th><td> XMLCh* </td></tr>
  435. <tr><th><em>note: </em></th><td> See <jump href="program-others-&XercesC3Series;.html#UseSpecificScanner">Use Specific Scanner</jump>
  436. for more programming details. </td></tr>
  437. </table>
  438. <p/>
  439. <table>
  440. <tr><th
  441. colspan="2"><em>setSecurityManager(Security Manager * const)</em></th></tr>
  442. <tr><th><em>Description</em></th>
  443. <td>
  444. Certain valid XML and XML Schema constructs can force a
  445. processor to consume more system resources than an
  446. application may wish. In fact, certain features could
  447. be exploited by malicious document writers to produce a
  448. denial-of-service attack. This property allows
  449. applications to impose limits on the amount of
  450. resources the processor will consume while processing
  451. these constructs.
  452. </td></tr>
  453. <tr><th><em>Value</em></th>
  454. <td>
  455. An instance of the SecurityManager class (see
  456. <code>xercesc/util/SecurityManager</code>). This
  457. class's documentation describes the particular limits
  458. that may be set. Note that, when instantiated, default
  459. values for limits that should be appropriate in most
  460. settings are provided. The default implementation is
  461. not thread-safe; if thread-safety is required, the
  462. application should extend this class, overriding
  463. methods appropriately. The parser will not adopt the
  464. SecurityManager instance; the application is
  465. responsible for deleting it when it is finished with
  466. it. If no SecurityManager instance has been provided to
  467. the parser (the default) then processing strictly
  468. conforming to the relevant specifications will be
  469. performed.
  470. </td></tr>
  471. <tr><th><em>Value Type</em></th><td> SecurityManager* </td></tr>
  472. </table>
  473. <p/>
  474. <table>
  475. <tr><th
  476. colspan="2"><em>setLowWaterMark(XMLSize_t)</em></th></tr>
  477. <tr><th><em>Description</em></th>
  478. <td>
  479. If the number of available bytes in the raw buffer is less than
  480. the low water mark the parser will attempt to read more data before
  481. continuing parsing. By default the value for this parameter is 100
  482. bytes. You may want to set this parameter to 0 if you would like
  483. the parser to parse the available data immediately without
  484. potentially blocking while waiting for more date.
  485. </td></tr>
  486. <tr><th><em>Value</em></th>
  487. <td>
  488. New low water mark.
  489. </td></tr>
  490. <tr><th><em>Value Type</em></th><td> XMLSize_t </td></tr>
  491. </table>
  492. <p/>
  493. <table>
  494. <tr><th
  495. colspan="2"><em>setInputBufferSize(const size_t bufferSize)</em></th></tr>
  496. <tr><th><em>Description</em></th>
  497. <td>
  498. Set maximum input buffer size.
  499. This method allows users to limit the size of buffers used in parsing
  500. XML character data. The effect of setting this size is to limit the
  501. size of a ContentHandler::characters() call.
  502. The parser's default input buffer size is 1 megabyte.
  503. </td></tr>
  504. <tr><th><em>Value</em></th>
  505. <td>
  506. The maximum input buffer size
  507. </td></tr>
  508. <tr><th><em>Value Type</em></th><td> XMLCh* </td></tr>
  509. </table>
  510. <p/>
  511. </s3>
  512. </s2>
  513. </s1>