Implement XBEL writing