Validate against an inline schema

This should cover W3C XML Schema, Relax NG and DTD related problems.
Posts: 1

Validate against an inline schema

Mon Oct 22, 2012 5:22 pm

Maybe I'm missing something very obvious, but I'm using the simple inline example found at: . I'm wondering how to tell oXygen to validate the <f:a.../> node. If I press the validation button, it says there is no associated schema, but if I don't do anything it obviously is not validating the node (I can change it to <f:b.../> with no error.

What am I missing?
Posts: 2337

Re: Validate against an inline schema

Tue Oct 23, 2012 11:13 am


The default validation from Oxygen first tries to determine the associated schema. If it can't find one, it reports the error:
There is no schema or DTD associated with the document. You can create an association either with the Associate Schema action or configuring in the Options the Preferences/Document Type Association list, or by creating a Validation Scenario.

In addition, by default Oxygen validates XML files with Xerces, which does not support inline schemas. The solution is to use a different validator that supports inline schemas, namely MSXML.NET. To accomplish this you have to create a custom validation scenario:
1. Go to main menu > Document -> Validate -> Configure Validation Scenario(s) (there's a corresponding action in the toolbar).
2. In the Configure Validation Scenario(s) dialog press New, choose a name for the scenario and change the Validation engine to MSXML.NET. Leave the other fields from the validation unit to their default values.
3. Press OK in the "Edit scenario" dialog and "Apply associated".

Now each time you press the validation button, Oxygen uses the associated validation scenario. Note that because "MSXML.NET" is an external engine, it will validate the saved file from the file system. This means that "Automatic validation" (validate as you type) is not available and also when you manually validate with this scenario, Oxygen will prompt you to save all opened files (if any) prior to validating.

If you need to associate this validation scenario with multiple files, you can do so from the project view. Select the XML files(or their parent folder) in the project view and right clicking and selecting Validate -> Configure Validation Scenario. Then enable the scenario from the list and press OK. If you've chosen a folder this will associate the scenario with all the files from that folder (even if they are of other type than XML). So you should make sure you don't accidentally associate validation scenarios to files that the scenario won't apply to.

Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger

Return to “XML Schemas”

Who is online

Users browsing this forum: No registered users and 2 guests