Support Schema Document objects. Chdir for schema.

Previously the patcher expected strings with the schema or XML
document. This is less efficient when the document object has
already been built.

Also chdir before loading schema to support relative filename
references in schema import statements.