You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: gxmlwrite.m
    path of file: ./repos/GIBBON/lib
    
    the code of the file until where you have to start completion: function [varargout]=gxmlwrite(varargin)

% function [varargout]=gxmlwrite(fileName,domNode,writeMode)
% ------------------------------------------------------------------------
% This function serializes an XML Document Object Model node (domNode) to a
% file (fileName). The XML file is created using either the Xerces parser
% (writeMode=1) or MATLAB's parser (writeMode=2). The MATLAB parses is

    
function [varargout]=gxmlwrite(varargin)

% function [varargout]=gxmlwrite(fileName,domNode,writeMode)
% ------------------------------------------------------------------------
% This function serializes an XML Document Object Model node (domNode) to a
% file (fileName). The XML file is created using either the Xerces parser
% (writeMode=1) or MATLAB's parser (writeMode=2). The MATLAB parses is
% known to have issues for MATLAB 2017a-b. 
%
% The function is similar to MATLAB's xmlwrite function. However by default
% it uses the Xerces parser rather than MATLAB's parser. 
%
% Kevin Mattheus Moerman
% gibbon.toolbox@gmail.com
%
% Change log: 
% 2017/08/18: Created
% ------------------------------------------------------------------------

%% Parse input

switch nargin
    case 1        
        domNode=varargin{1};
        fileName=[];
        writeMode=2;
    case 2
        fileName=varargin{1};
        domNode=varargin{2};
        writeMode=1;
    case 3
        fileName=varargin{1};
        domNode=varargin{2};
        writeMode=varargin{3};
    otherwise
        error('Wrong number of input arguments');
end