Skip to content

Commit

Permalink
Updated README
Browse files Browse the repository at this point in the history
  • Loading branch information
szajbus committed Apr 9, 2018
1 parent 5f54d94 commit 82d9579
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ end
* `encoding` - Forces the parser to work in given encoding
* `recovery` - Should this parser recover from structural errors? It will not stop processing file on structural errors if set to `true`.
* `replace_entities` - Should this parser replace entities? `&` will get converted to `&` if set to `true`.
* `error_handler` - If set to a callable, parser will call it with any error it encounters instead of raising exceptions.

Combination of `error_handler` and `recovery` options allows for continued processing when encountering recoverable errors (e.g. unescaped [predefined entities](https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Predefined_entities_in_XML)).

```ruby
error_handler = proc { |e| $stderr.puts "#{e.message} at line #{e.context.line}, column #{e.context.column}." }
Saxy.parse(path_or_io, object_tag, error_handler: error_handler, recovery: true) { ... }
```

## Example

Expand Down

0 comments on commit 82d9579

Please sign in to comment.