separate input buffer handling from parsing code, add attribute parsing