Agreed, TEXT datatypes are like other datatypes as chalk is like cheese.
However interesting article, a shame it was hard work to read.
But it looks like there is an error in a code.
If XML tag happens start right before position 8000 (or multiple of) it will not be found.
This may be a fix:
Set @parsedlen = @parsedlen + 8000 - len(@parsedval)+1