How do I compress a file into .xip format?
No, .xip files have nothing to do with .zip files - it's not the same format at all. .xip files are really a type of xar archive.
If you want to compress your own .xip file, you can do that with the xip command in macOS:
xip file1 file2 file3 archive.xip

However you cannot compress Xcode.app to a .xip file and send that to others and expect them to be able to just unpack it by double-clicking. The file will be verified to see if the .xip is signed by Apple - if it is not, it will not be automatically unpacked.