Updated XMLSerializer to be more consistent with Java's serialize, extracted some constants