* htmlCtxtUseOptions: * @ctxt: an HTML parser context * @options: a combination of htmlParserOption(s) * * Applies the options to the parser context * * Returns 0 in case of success, the set of unknown or unimplemented options * in case of error. */
| 5890 | * in case of error. |
| 5891 | */ |
| 5892 | int |
| 5893 | htmlCtxtUseOptions(htmlParserCtxtPtr ctxt, int options) |
| 5894 | { |
| 5895 | if (ctxt == NULL) |
| 5896 | return(-1); |
| 5897 | |
| 5898 | if (options & HTML_PARSE_NOWARNING) { |
| 5899 | ctxt->sax->warning = NULL; |
| 5900 | ctxt->vctxt.warning = NULL; |
| 5901 | options -= XML_PARSE_NOWARNING; |
| 5902 | ctxt->options |= XML_PARSE_NOWARNING; |
| 5903 | } |
| 5904 | if (options & HTML_PARSE_NOERROR) { |
| 5905 | ctxt->sax->error = NULL; |
| 5906 | ctxt->vctxt.error = NULL; |
| 5907 | ctxt->sax->fatalError = NULL; |
| 5908 | options -= XML_PARSE_NOERROR; |
| 5909 | ctxt->options |= XML_PARSE_NOERROR; |
| 5910 | } |
| 5911 | if (options & HTML_PARSE_PEDANTIC) { |
| 5912 | ctxt->pedantic = 1; |
| 5913 | options -= XML_PARSE_PEDANTIC; |
| 5914 | ctxt->options |= XML_PARSE_PEDANTIC; |
| 5915 | } else |
| 5916 | ctxt->pedantic = 0; |
| 5917 | if (options & XML_PARSE_NOBLANKS) { |
| 5918 | ctxt->keepBlanks = 0; |
| 5919 | ctxt->sax->ignorableWhitespace = xmlSAX2IgnorableWhitespace; |
| 5920 | options -= XML_PARSE_NOBLANKS; |
| 5921 | ctxt->options |= XML_PARSE_NOBLANKS; |
| 5922 | } else |
| 5923 | ctxt->keepBlanks = 1; |
| 5924 | if (options & HTML_PARSE_RECOVER) { |
| 5925 | ctxt->recovery = 1; |
| 5926 | options -= HTML_PARSE_RECOVER; |
| 5927 | } else |
| 5928 | ctxt->recovery = 0; |
| 5929 | if (options & HTML_PARSE_COMPACT) { |
| 5930 | ctxt->options |= HTML_PARSE_COMPACT; |
| 5931 | options -= HTML_PARSE_COMPACT; |
| 5932 | } |
| 5933 | ctxt->dictNames = 0; |
| 5934 | return (options); |
| 5935 | } |
| 5936 | |
| 5937 | /** |
| 5938 | * htmlDoRead: |
no outgoing calls