PostgreSQL xmloption setting
it is connection specific,

All plain set commands are. (see the set command in sql refernce)

You can make the setting persistent using.

ALTER[user|database] name SET xmloption TO DOCUMENT ;

see the ALTER command in sql reference

Alternatively you can prepare the session or prepend to the stream being sent to psql, you don't need to edit the actual disk file.

In the following examples everything upto the $ represents the prompt,

Using the psql command-line:

  database-$ SET xmloption TO DOCUMENT ;
  database-$ \i filename 


Or the system commmand-line

~$ psql "conmnection-parameters" -c "SET xmloption TO DOCUMENT" -f "filename"