(how) does Oxygen add Schematron Quick Fixes dynamically?

Having trouble installing Oxygen? Got a bug to report? Post it all here.
Ron Van den Branden
Posts: 65
Joined: Fri Jan 18, 2008 5:54 pm

(how) does Oxygen add Schematron Quick Fixes dynamically?

Post by Ron Van den Branden »

Hi,

I've been toying with Oxygen's implementation of Schematron Quick Fixes (SQF), and discovered that Oxygen seems to generate SQF rules based on what's in a schema. As soon as I define a closed attribute list in my (RelaxNG) schema, like this:

Code: Select all


<element name="title">
<ref name="macro.paraContent"/>
<ref name="att.global.attributes"/>
<optional>
<attribute name="type">
<choice>
<value>main</value>
<value>sub</value>
</choice>
</attribute>
</optional>
</element>
If I validate a document against this schema, with a title such as <title type="first">, this is flagged, and two SQF options are proposed:

Image

This is great, though a bit confusing at first (the schema itself doesn't contain any trace of a SQF). I'm wondering: where do these SQF'es come from, does Oxygen insert them automatically, and if so, are there other schema constructs besides closed attribute lists that trigger them? Or is this documented anywhere?

On a related note (and since there is no SQF mailing list I'm aware of), is it possible to create a similar SQF by hand? I mean, I have some Schematron rules that compute suggested values for an attribute from the content in a document. That's perfectly doable with a Schematron variable. Yet, say that variable contains two suggested values, "a" and "b", would it be possible to express in SQF that two possible fixes should be proposed, namely to:
  • set the value of the attribute in the XML source to "a"
  • set the value of the attribute in the XML source to "b"
?

The point is that I don't know in advance what the possible values are; those are computed from what's in the document. Can this be done dynamically with SQF, as seems to be the case for the closed attribute list example in the schema above?

Many thanks for your thoughts,

Ron
tavy
Posts: 364
Joined: Thu Jul 01, 2004 12:29 pm

Re: (how) does Oxygen add Schematron Quick Fixes dynamically

Post by tavy »

Hi Ron,

For XML documents there are two types of quick fixes:
1. Quick fixes generated automatically from the XSD or RNG validation error messages. Oxygen offers quick fixes for common errors like missing attribute, or required element. You can read more about this here:
http://www.oxygenxml.com/doc/ug-editor/ ... fixes.html
2. Custom quick fixes created by the user using the SQF (Schematron Quick Fix) language. You can read more about this here:
http://www.oxygenxml.com/doc/ug-editor/ ... fixes.html
http://www.oxygenxml.com/doc/ug-editor/ ... g-sqf.html

Yes, you ca create a fix based on the values from the document. In your case you need to create a fix for each value you want to set. Then make available the fix when you have available the value in the document using the @use-when attribute. You can read more about the @use-when attribute in our user manual in the Use-When Condition section.
The fixes are computed each time a modification is made in the document. So, if you add or remove a value the quick fixes will be regenerated depending on the values that you have set in the document.

There is a mailing list on the w3c community group Quick-fix support for XML, you can register here: http://lists.w3.org/Archives/Public/public-quickfix/.
There is also a github project where you can add issues: https://github.com/schematron-quickfix/sqf


Best Regards,
Octavian
Octavian Nadolu
<oXygen/> XML Editor
http://www.oxygenxml.com
Ron Van den Branden
Posts: 65
Joined: Fri Jan 18, 2008 5:54 pm

Re: (how) does Oxygen add Schematron Quick Fixes dynamically

Post by Ron Van den Branden »

Hi Octavian,

Many thanks for your clarifications. Apologies I hadn't found the documentation for the "Quick Fixes for XSD and Relax NG Errors" before.
Yes, you ca create a fix based on the values from the document. In your case you need to create a fix for each value you want to set. Then make available the fix when you have available the value in the document using the @use-when attribute.
Unfortunately, in this case the possible values are not known in advance, so I can't create a list of quick fixes in advance. I want to offer editors help with suggesting name regularizations based on the values found for a name in a regularization list. This works well with a Schematron Quick Fix if only one candidate regularization is found, but I'm looking for a way to offer separate SQF suggestions for each separate candidate regularization. I was hoping for a way to dynamically create separate SQF suggestions for each candidate regularization.

Thanks for the pointers to probably more appropriate channels for such questions.

Best,

Ron
tavy
Posts: 364
Joined: Thu Jul 01, 2004 12:29 pm

Re: (how) does Oxygen add Schematron Quick Fixes dynamically

Post by tavy »

Hi Ron,

Maybe you can add an issue with your use case on the github project: https://github.com/schematron-quickfix/sqf/issues
A solution to your use case can be the "sqf:user-entry", but this is not supported in the oXygen 17. With the sqf:user-entry the fix can be done in two steps. The fix proposal will say something like "change the value of the attribute in the XML source", and then the user is asked about the value to be set by presenting a dialog with the proposed values. This solution is ok for you, or you want to create dynamically all the proposals as fixes?

Best Regards,
Octavian
Octavian Nadolu
<oXygen/> XML Editor
http://www.oxygenxml.com
Ron Van den Branden
Posts: 65
Joined: Fri Jan 18, 2008 5:54 pm

Re: (how) does Oxygen add Schematron Quick Fixes dynamically

Post by Ron Van den Branden »

Hi Octavian,

Many thanks for your thoughts.
This solution is ok for you, or you want to create dynamically all the proposals as fixes?
A way to create fixes dynamically for each proposal is what I was looking for originally; I'll definitely inquire at the github tracker.

Yet, sqf:user-entry definitely sounds interesting; this seems to be a probable use case, if you need any ;-).

Best,

Ron
tavy
Posts: 364
Joined: Thu Jul 01, 2004 12:29 pm

Re: (how) does Oxygen add Schematron Quick Fixes dynamically

Post by tavy »

Hi Ron,

There is an issue on our issue tracker to add support for the "sqf:user-entry" in oXygen. This is scheduled for the next oXygen release version. I added a +1 to the issue and we will notify you when this will be implemented.

Next week there will be a webinar that covers the quick fix support for XML documents in oXygen: "oXygen XML Editor 17 - XML Quick Fixes". You can register here:
http://www.oxygenxml.com/events/2015/we ... fixes.html

Best Regards,
Octavian
Post Reply