Logo Search packages:      
Sourcecode: scummvm version File versions  Download package

virtual bool Common::XMLParser::skipComments (  )  [inline, protected, virtual]

Skips comment blocks and comment lines. Returns true if any comments were skipped. Overload this if you want to disable comments on your XML syntax or to change the commenting syntax.

Definition at line 320 of file xmlparser.h.

References parserError(), Common::ReadStream::readByte(), and Common::SeekableReadStream::seek().

Referenced by parse().

                                  {
            if (_char == '<') {
                  _char = _stream->readByte();

                  if (_char != '!') {
                        _stream->seek(-1, SEEK_CUR);
                        _char = '<';
                        return false;
                  }

                  if (_stream->readByte() != '-' || _stream->readByte() != '-')
                        return parserError("Malformed comment syntax.");

                  _char = _stream->readByte();

                  while (_char) {
                        if (_char == '-') {
                              if (_stream->readByte() == '-') {

                                    if (_stream->readByte() != '>')
                                          return parserError("Malformed comment (double-hyphen inside comment body).");

                                    _char = _stream->readByte();
                                    return true;
                              }
                        }

                        _char = _stream->readByte();
                  }

                  return parserError("Comment has no closure.");
            }

            return false;
      }


Generated by  Doxygen 1.6.0   Back to index