Cast xml.length for 32-bit correctness