Created
December 28, 2015 14:40
-
-
Save Gernot/ee8ec5e66e18d0e51bf3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Is there any way to use the Options from libxml2 with the cool new `OptionSet` Syntax from Swift 2? | |
//This is how I do it now | |
let options = Int32(HTML_PARSE_RECOVER.rawValue | HTML_PARSE_NOWARNING.rawValue | HTML_PARSE_NOERROR.rawValue) | |
// ideally I want this, but it doesn't work | |
let options: htmlParserOption = [HTML_PARSE_RECOVER, HTML_PARSE_NOWARNING, HTML_PARSE_NOERROR] | |
//here's the typedef from libxml/HTMLparser.h | |
/* | |
typedef enum { | |
HTML_PARSE_RECOVER = 1<<0, /* Relaxed parsing */ | |
HTML_PARSE_NODEFDTD = 1<<2, /* do not default a doctype if not found */ | |
HTML_PARSE_NOERROR = 1<<5, /* suppress error reports */ | |
HTML_PARSE_NOWARNING= 1<<6, /* suppress warning reports */ | |
HTML_PARSE_PEDANTIC = 1<<7, /* pedantic error reporting */ | |
HTML_PARSE_NOBLANKS = 1<<8, /* remove blank nodes */ | |
HTML_PARSE_NONET = 1<<11,/* Forbid network access */ | |
HTML_PARSE_NOIMPLIED= 1<<13,/* Do not add implied html/body... elements */ | |
HTML_PARSE_COMPACT = 1<<16,/* compact small text nodes */ | |
HTML_PARSE_IGNORE_ENC=1<<21 /* ignore internal document encoding hint */ | |
} htmlParserOption; | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment