XML ALGORITHM