Re: [libYAML] Error recovery?

Kirill Simonov <[email protected]>
Newsgroups gmane.text.yaml.general
Message-ID <[email protected]>
Hi Marc,

> I'm transmitting events in YAML format. This is done by sending events
> as documents over a single connection.
> 
> The documents are received using yaml_parser_load(). However, I can't
> ensure that all documents are always "well formed" (for example due to
> transmission errors).
> 
> Once a parser error has occured, how can I get the parser back to a
> working state, where it is ready to accept another document?

The libyaml parser cannot be recovered after an error has occurred.  You 
need to create a new parser instance if you want to process other 
documents after an error condition.

A possible recovering strategy is to seek through the input stream until 
the pattern "[\r\n]---[ \t\r\n]" is found.  Then you can parse the new 
document starting from this position.


Thanks,
Kirill

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.