Skip to content

Commit

Permalink
reformat parser.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
dginev committed Sep 20, 2018
1 parent fdce7fd commit 9097d53
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ impl Parser {
pub fn parse_file(&self, filename: &str) -> Result<Document, XmlParseError> {
let c_filename = CString::new(filename).unwrap();
let c_utf8 = CString::new("utf-8").unwrap();
let options: i32 = XmlParserOption::Recover as i32 + XmlParserOption::Noerror as i32
let options: i32 = XmlParserOption::Recover as i32
+ XmlParserOption::Noerror as i32
+ XmlParserOption::Nowarning as i32;
match self.format {
ParseFormat::XML => unsafe {
Expand All @@ -97,7 +98,8 @@ impl Parser {
ParseFormat::HTML => {
// TODO: Allow user-specified options later on
unsafe {
let options: i32 = HtmlParserOption::Recover as i32 + HtmlParserOption::Noerror as i32
let options: i32 = HtmlParserOption::Recover as i32
+ HtmlParserOption::Noerror as i32
+ HtmlParserOption::Nowarning as i32;
xmlKeepBlanksDefault(1);
let docptr = htmlReadFile(c_filename.as_ptr(), c_utf8.as_ptr(), options);
Expand All @@ -118,7 +120,8 @@ impl Parser {
let c_url = CString::new("").unwrap();
match self.format {
ParseFormat::XML => unsafe {
let options: i32 = XmlParserOption::Recover as i32 + XmlParserOption::Noerror as i32
let options: i32 = XmlParserOption::Recover as i32
+ XmlParserOption::Noerror as i32
+ XmlParserOption::Nowarning as i32;
let docptr = xmlReadDoc(
c_string.as_bytes().as_ptr(),
Expand All @@ -133,7 +136,8 @@ impl Parser {
}
},
ParseFormat::HTML => unsafe {
let options: i32 = HtmlParserOption::Recover as i32 + HtmlParserOption::Noerror as i32
let options: i32 = HtmlParserOption::Recover as i32
+ HtmlParserOption::Noerror as i32
+ HtmlParserOption::Nowarning as i32;
let docptr = htmlReadDoc(
c_string.as_bytes().as_ptr(),
Expand Down

0 comments on commit 9097d53

Please sign in to comment.