Re: [Libxmlplusplus-general] Parser abstraction



Christophe de Vienne wrote:

The main interest I see in keeping an abstraction for parser is that they have common options. One thing I want to be done on it is to be able to configure the parsers through this abstact Parser class. The options I'm refering to concerns, for exemple, if the document has to be validated or not. I don't have in mind the complete list of them but they're is other ones that are interesting to have. The difference between both parsers is the output, but the input is exactly the same : we can parse a file, a buffer, a stream, and the abstraction defines only how input can be given to the Parser, not the way to retrieve any result.

ok, I see. Well, this option-setting mechanism isn't currently part of the
API. Would it be, I probably wouldn't ask the question.


I don't think having a Document class is incompatible with a parser abstraction. Your factory function is in fact a DomParser, which returns a Document instead of a root_node (this probably better, since it's closer to libxml).

indeed.

Moreover, I personnaly think that having a DomParser class makes more natural the fact to have several parser working at the same time.

I don't understand that. Again, generating a document object doesn't involve
any state that justifies a parser *object*. Even the parser options you are
talking about could well be put into the 'create_document' function arguments
(with sensible default values).

Stefan





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]