Oxygen doesn't have a specialized batch (bulk ) "Associate Schema" operation that makes the association within the XML file. Note that the association with RelaxNG appears in the XML file as a processing instruction. e.g.
Code: Select all
<?xml-model href="path/to/my/schema.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"?>
Unfortunately XML Refactoring cannot be used in this case (the change/insertion) in the XML is before the root element.
However, for local files you may not need to make this association if you use the files within Oxygen with an Oxygen project. You can create a custom validation scenario that specifies your customized schema (project level), and associate that validation scenario with your XML files in the Project view. Oxygen will use the schema from the custom validation scenario for validation and content completion.
To accomplish this:
Make sure you have a persistent project (.xpr) file. Create/save a project (Project > New Project
) in the parent folder (or higher in the hierarchy) of your XML files.
If the project file is in the parent folder or higher, you should already see your files when expanding folders in the Project view. If not, you can manually link your XML files folder (right click on project root and pick Add folder
), or the individual files (right click on project root and pick Add Files
In the Project view right click on one of the files (or the entire folder or file selection) and pick Validate > Configure Validation Scenario, New. Give it a proper name (e.g."Validate with myschema.rng"). Double click the Schema cell, pick Use custom schema, and browse for your schema. OK in all dialogs and Save and close
If you want to associate this with additional files, right click on the folder or file selection, pick Validate > Configure Validation Scenario, and just select (check the box) for the scenario configured at step 3.
Now when you open one of the files for which you made this validation scenario association, it will automatically be validated with your configured scenario. You can check in the Properties
view (Window > Show view > ...
) for Validation scenario
and the schema being used, Content Completion
Since you mentioned eXist-db, you might have to make the schema association within the files anyway. Since XML Refactoring cannot be used in this situation, the quick and dirty way is to use "Find/Replace in Files".
eXist usually omits the XML declaration, so you can add your schema association at the beginning or right before the root.
How does your average XML file look like (first couple of lines up to and including the root)?