default validation scenario ?

This should cover W3C XML Schema, Relax NG and DTD related problems.
sdm7g
Posts: 13
Location: University of Virginia

default validation scenario ?

Tue Mar 26, 2013 11:04 pm

I have some schema based EAD xml files with no DTD or DOCTYPE, no xsi:schemaLocation attribute and no
<?oXygen_pi RNGSchema=... PI. ( Partly because I'm evaluating XSD vs RNG and RNG doesn't like the schemaLocation attribute.)

I have several validation scenarios defined, but none of them are checked.
When I bring up the 'Configure Validation Scenarios' window, it also says at the bottom:

Associated scenarios ---
There are no scenarios associated with the document(s). In this case, the default
validation
will be applied.


When I click on Apply default validation or choose Validate from the Document/Validate menu,
what scenario is being applied ? What is the document being validated against ?

It says that the document is valid, BTW.
adrian
Posts: 2337

Re: default validation scenario ?

Wed Mar 27, 2013 5:18 pm

Hello,

If no explicit validation scenario is associated, then Oxygen validates with the detected DTD/schema.
If there is no explicit DTD/schema associated within the XML document (DOCTYPE, PI, etc), then the schema detection looks at the schema available for the detected document type (if one matches this XML document).

Look in the Properties view (Window > Show View > Properties) for Document type and Content Completion. The schema used for content completion is also used for validation in such cases.

When the validation reports an error, you actually have more information readily available in the Errors view about what file was validated, against what DTD/schema and from what validation scenario (if specified).


In your specific case (you mentioned EAD), I'm guessing Oxygen detects the EAD document type and uses the established schema for that document type. If that's the case, you can change the schema from Options > Preferences, Document Type Association, select EAD and press Edit (duplicate if asked) and go to the Schema section.

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
sdm7g
Posts: 13
Location: University of Virginia

Re: default validation scenario ?

Wed Mar 27, 2013 6:03 pm

Look in the Properties view (Window > Show View > Properties) for Document type and Content Completion. The schema used for content completion is also used for validation in such cases.


Thanks. That worked. I also found this post: http://www.oxygenxml.com/pipermail/oxygen-user/2011-November/003934.html * which mentioned checking (Window>Show View>Information).

Both show it's using the ead.rng from the Application frameworks: file:/Applications/oxygen/frameworks/ead/rng/ead.rng

* BTW: Found that link after googling "oxygen_pi" and found this note http://www.oxygenxml.com/doc/ug-editor/concepts/oxygen-processing-instruction.html that <?xml-model ... has superceded that PI for associating
schema.
adrian
Posts: 2337

Re: default validation scenario ?

Wed Mar 27, 2013 6:13 pm

Hi,

You are correct, the Information view shows all validation log messages (among document type, content completion and Author CSS messages), so it's a lot clearer what schema is used for validation.

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
sdm7g
Posts: 13
Location: University of Virginia

Re: default validation scenario ?

Wed Mar 27, 2013 10:40 pm

I tried adding multiple xml-model PI lines as in the examples in http://www.w3.org/TR/2011/NOTE-xml-model-20110811/. I was wondering which one it would use, of if it would show those as options.


Code: Select all

<?xml-model href="/projects/schema-files/ead.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"
    title="EAD relaxng schema" ?>
<?xml-model href="/projects/schema-files/ead.xsd" type="application/xml" schematypens="http://www.w3.org/2001/XMLSchema"
   title="EAD W3C/XSD schema" ?>
<?xml-model href="/projects/schema-files/ead.rnc" type="application/relax-ng-compact-syntax" 
    title="EAD relaxng compact schema" ?>


From the display in the (Window>Show View>Information) window it appears that:
  • it changes the Content Completion schema to one of those above ( how does it pick one? ),
    however the Properties window still shows it using the /Applications/oxygen/frameworks schema.
    OK: I just saved and reloaded the file with those lines, and that updated the value in the Properties Window
    to match. But I'm still wondering why it chooses the middle option.
  • it validates using all three schema.

Can you confirm if that last obs. is true ?



Code: Select all

[15:07:18] - Content Completion schema(s) changed: [file:/projects/schema-files/ead.xsd]
[15:07:52] - XMLSchema XML Error Scanner - start scanning file:/projects/schema-files/published/uva-sc/viu00003.xml with schema(s): file:/projects/schema-files/ead.xsd
[15:07:53] - Found 0 problem(s)
[15:07:53] - start scanning file:/projects/schema-files/published/uva-sc/viu00003.xml with schema(s): file:/projects/schema-files/ead.rng
[15:07:53] - Found 0 problem(s)
[15:07:53] - start scanning file:/projects/schema-files/published/uva-sc/viu00003.xml with schema(s): file:/projects/schema-files/ead.rnc
[15:07:53] - Found 0 problem(s)



Although that W3C document has an example with multiple associations, it doesn't seem to define any semantics for that case.

Maybe it would be more useful if Oxygen could populate the Validation scenarios with those options, and choose one by default.
adrian
Posts: 2337

Re: default validation scenario ?

Thu Mar 28, 2013 2:02 pm

Hi,

Yes, if you associate multiple schemas with xml-model PIs, the default validation from Oxygen validates with all schemas. Reported errors are grouped together for each schema validation.
When multiple schemas are associated, the content completion favors XML Schema (.xsd) ahead of the others (followed by RNG and last RNC).

The Validation scenarios are meant to be an alternative to this solution which manually specifies the schema(s) in each XML file. They are also meant to be associated with multiple files or to batch validate multiple files.

Currently a newly created validation scenario contains a validation unit that dynamically detects the schemas at validation time (Use detected schema).
I guess it would be an interesting idea to optionally create a validation scenario starting from the statically detected schemas. I'll submit this as a feature request.

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

Return to “XML Schemas”

Who is online

Users browsing this forum: No registered users and 0 guests