public ParserState process (int ch) throws ParserException {
char c = (char) ch;
DocumentBuilder builder = getDocumentBuilder ();
if (_isShort && c != '>') {
throw new ParserException ("Invalid short tag.");
}
if (XMLCharacterSet.isNameChar (c)) {
if (_isAdded) {
return new AttributeState (builder, this, ch);
}
_name.append (c);
return this;
}
if (XMLCharacterSet.isWhiteSpace (c)) {
if (!_isAdded) {
builder.createTagStart (_name.toString ());
_isAdded = true;
}
return this;
}
if (c == '/') {
_isShort = true;
return this;
}
if (c == '>') {
if (!_isAdded) {
builder.createTagStart (_name.toString ());
}
builder.finishTagStart ();
if (_isShort) {
builder.addTagClose (_name.toString ());
}
return new NormalState (builder);
}
throw new ParserException ("Illegal character '" + c + "'.");
}