case STATE_OPEN_TAGxATTR_NAME_READ:
if (c == '=') {
--_index;
_state = STATE_OPEN_TAGxEQUAL_READ;
} else if (c > ' ') { throw new XMLStreamException(
"'=' expected", _location); }
break;
case STATE_OPEN_TAGxEQUAL_READ:
if (c == '\'') {
_start = --_index;
_state = STATE_OPEN_TAGxREAD_ATTR_VALUE_SIMPLE_QUOTE;
} else if (c == '\"') {
_start = --_index;
_state = STATE_OPEN_TAGxREAD_ATTR_VALUE_DOUBLE_QUOTE;
} else if (c > ' ') { throw new XMLStreamException(
"Quotes expected", _location); }
break;
case STATE_OPEN_TAGxREAD_ATTR_VALUE_SIMPLE_QUOTE:
while (true) { // Read attribute value all at once.
if (c == '\'') {
_attrValue = newSeq(_start, --_index - _start);
processAttribute();
_state = STATE_OPEN_TAGxELEM_NAME_READ;
break;
}
// Local character reading block.
if (_readIndex >= _readCount)
reloadBuffer();
c = _readBuffer[_readIndex++];
if (c == '&')
c = replaceEntity();
_data[_index++] = c;
}
break;
case STATE_OPEN_TAGxREAD_ATTR_VALUE_DOUBLE_QUOTE:
while (true) { // Read attribute value all at once.
if (c == '\"') {
_attrValue = newSeq(_start, --_index - _start);
processAttribute();
_state = STATE_OPEN_TAGxELEM_NAME_READ;
break;
}
// Local character reading block.
if (_readIndex >= _readCount)
reloadBuffer();
c = _readBuffer[_readIndex++];
if (c == '&')
c = replaceEntity();
_data[_index++] = c;
}
break;
case STATE_OPEN_TAGxEMPTY_TAG:
if (c == '>') {
_start = --_index;
_state = STATE_CHARACTERS;
processStartTag();
_isEmpty = true;
return _eventType = START_ELEMENT;
} else {
throw new XMLStreamException("'>' expected", _location);
}
// CLOSE_TAG:
case STATE_CLOSE_TAGxREAD_ELEM_NAME:
while (true) { // Element name can be read all at once.
if (c < '@') { // Else avoid multiple checks.
if (c == '>') {
_qName = newSeq(_start, --_index - _start);
_start = _index;
_state = STATE_CHARACTERS;
processEndTag();
return _eventType = END_ELEMENT;
} else if (c == ':') {
_prefixSep = _index - 1;
} else if (c <= ' ') {
_qName = newSeq(_start, --_index - _start);
_state = STATE_CLOSE_TAGxELEM_NAME_READ;
break;
}
}
if (_readIndex >= _readCount)
reloadBuffer();
c = _data[_index++] = _readBuffer[_readIndex++];
}
break;
case STATE_CLOSE_TAGxELEM_NAME_READ:
if (c == '>') {
_start = --_index;
_state = STATE_CHARACTERS;
processEndTag();
return _eventType = END_ELEMENT;
} else if (c > ' ') { throw new XMLStreamException(
"'>' expected", _location); }
break;
default:
throw new XMLStreamException("State unknown: " + _state,
_location);
}
}
}