Using XML to specify command line arguments
Published 06 February 2013
You can use an XML file to specify the arguments for the command line interface. You may want to do this because:
- An XML file is easier to read than a long and complex command line, particularly where complex rules for including and excluding objects are specified.
- You can easily transform an XML file into other formats using XSLT.
For example, you could transform your argument file to HTML for presentation on a Web page. - Using an XML file overcomes some limitations that can be a problem when you want to specify regular expressions as command line arguments.
For example, you may want to use the pipe character ( | ) as part of a regular expression, but it causes problems when it is used at the command prompt; if you use an XML file you can use the pipe character with no problems. - Most programming languages support XML, through built-in or freely available third-party libraries.
- This makes it easy to generate and process the XML file.
Create the XML file in the following format:
<?xml version="1.0"?>\\<commandline> <switch_name1/> <switch_name2>switch_value</switch_name2> .... </commandline>
For example, for the /includeschema
and /excludeschema
switches, use the following format:
<includeschema>objecttype:RegularExpression</includeschema>
To execute the command line tools using an XML argument file as input, at the command prompt enter:
sqlpackager /argfile:XMLfilename.xml
When you use an XML file to supply the arguments, you cannot specify any other switches on the command line except /verbose
or /quiet
.