Using schema annotations in Xforms - orbeon

(I'm using Orbeon Forms 2019.2.0.201912301747 CE). I have a bunch of XForms for which the schemas are in a JAR file in orbeons "WEB-INF\lib". (I am able to get individual schemas using the "oxf:" protocol).
XML Schema has "annotations/documentation" and "annotations/appInfo" elements (intended for use by the application) and I swear that in the past I've read how to access these in XForms, but searching online I can no longer find any information about it! I'd like to find out if I can use "appInfo" in the schema to store text presented to the user (xforms alerts or hints), instead of breaking it out into a separate xml file. (The reason being that subsequent versions of the schema might have this text change, and an XSD documenter can pick up this information.)
I remember it being something pretty simple. Is there someone here who does this? Does it work with Orbeon?

The possibility that comes to mind would be to load the XML Schema into an XForms instance. This is possible because the XML Schema is in XML as well. Then you can refer to various parts of the Schema with XPath in labels, hints, etc. You just need, of course, to know the path to those elements in the XML Schema file.

Related

Using Swagger UI Express / #nestjs/swagger, What is best practice to edit API response codes, descriptions and other properties

So I currently already have the swagger UI set up with the page and everything, but I want to edit the .json file (so I can provide descriptions, error codes and stuff but all in one document). Was just wondering where I should be locating my swagger.json or swagger.yaml file to be able to adjust the API??
If not, what's the best practice for documenting parameters, response codes and descriptions WITHOUT having to do it tediously one by one like below...
Any advice on using swagger with nestjs applications would be much appreciated :) Still very new with using it

RIAK and Swagger UI

I am learning about RIAK and thinking about using it to store JSON objects.
I have also used swagger UI many times in the past to document API's.
I would like to build a simple example bucket in RIAK with a swagger UI style API. This could be simple out of the box functionality. All I need to do is define a model for the JSON object and it should be possibly to automatically create a swagger file with get, post, put options for that object.
I have googled "swagger Riak" but I can't find any articles with both words in them.
Is there a better phrase I should be searching for?

Send data to XForms

I am trying to use an XForms document that creates an instance from a different XML document depending on a request parameter or header. I can't find a way to do it without using Orbeon's xxforms:get-request-parameter().
Orbeon also suggest this:
<xforms:instance id="user-data" src="input:instance"/>
I might be able to use this (assuming BetterForms supports it) but I need multiple XML documents as inputs. I may be able to rig up a way to put all the XML documents into one post XML fragment, but that's not much fun either.
I originally tried generating the XForms as the return of an XQuery document with request:get-parameter() but I'm running into problems with it. Is there something I'm missing or are these methods the only good ways to send stuff to XForms?
At this point, it looks like your choices are as follows:
With Orbeon Forms, use the Orbeon's extension XPath functions to access the HTTP request.
With Better Forms or XSLTForms, contact the authors to see if they can implement the standard URI functions introduced in XForms 2.0.

Is there a way to add a Umbraco Custom Data Type that basically was a grouping of existing data types?

On a number of different document types, I have to add the same 3 native Umbraco data types
content picker
TextString
TextString
It was suggested to me to see if there is a way to create a new custom data type that would basically wrap those 3 datatypes into a new datatype.
I looked at nibble.be's site and see there is a couple different ways to go about creating custom data types (using the usercontrol wrapper, or 3 class approach). However, I am not sure that a custom data type for grouping existing datatypes would be the correct route.
For one thing, we are using MVC along side Umbraco with a heavy use of Razor views. Since the document type property alias is used to acquire values from Umbraco from the content page, I don't see how this would still be possible or how you would go about getting the property value of a custom datatype that has embedded datatypes.
Would there be a working way or a better way to accomplish this solution for having to add the same fields on any document type that they are needed? I though about hierarchical approach with a document type parent with only these 3 data types (content picker and 2 textstrings), but that would mean having to put any document type that a page would need under this parent document type simply for the fact to inherit these group of properties.
If you're looking to embed multiple properties into a single datatype:
There are a number of embedded datatypes available; DataType Grid, Embedded Content, and Repeatable Custom Content are the three I know of. All three store their information as xml which allows easy access via both xslt and razor.
The DataType Grid is part of uComponents and is therefore actively developed. It is also open source and therefore contributions are encouraged. Embedded Content and Repeatable Custom Content, while still useful, don't appear to have any current support and therefore no plans for improvement. I think they are licensed as open source, but the source isn't publicly available as far as I can tell.
I don't think you can set a limit on the number of rows/items stored in the DataType Grid, like you can in Embedded Content (perhaps a feature request).
Take a look at some of these solutions before you plan on rolling your own. But if you still feel the urge to code out your own data type, I'd recommend Tim Geyssens' articles on created custom datatypes using the user control wrapper, with data editor settings, and serializing the data as xml. His "Master of Datatypes" video is also really helpful and covers those topics as well.
If you're looking to organize your properties into groups:
Tom Fulton published a new package/data type recently called Document Type Fieldsets that may fit your needs. It allows you to group fields together in a fieldset. Here's a screen shot:
I realize this is an old question, so I'm just adding this for anyone searching for this functionality in the future: This is almost exactly what we use Widget Builder for in Umbraco 6.
Widget Builder is the predecessor to Umbraco 7's Archetype which is being pushed by the core team for near universal use. I believe it's going to become a part of the core.
Internally, WidgetBuilder and Archetype store their data as JSON and make it very easy to copy a custom data type from one project to another with an import/export feature.
I used to work with Archetype for some time until I discovered Nested Content which does the same thing but much easier to work with because it nests Document Types instead of Data Types which is much easier to work with, especially for Content Editors. Plus the resulting Data Types is normal built-in Umbraco ones, not Archetype Objects which add a new layer of Entity Mapping in your views.

Localization Strategy

We're currently debating two strategies of localization:
A. Have an XML file for the structure of the business objects with a Localized key to a separate CSV file for the translation.
for eg. /Resources/Schema.xml
in a separate CSV file: we have all key/value pairs for the translations:
/Resources/Localized.txt
Model_Title, Title, Title (in French), ...
This way, when the structure changes, we just change XML once while the LocalizedKey's are in place.
B. Have separate XML files for each language based on Culture.
eg. have two files:
/Resources/en-US/US-Localized.xml
/Resources/fr-AU/AU-Localized.xml
This way, they will have same schema but separate files. Therefore the user would have to make sure that the schemas are the same as they would need to change it twice as opposed to Option #1 where they can just change it once.
However, the readability here is much better since the user would not have to track the key the make the changes.
What are your thoughts/ideas on the strategies I suggested?
Thanks,
It is not clear about the environment -- web? desktop? internal enterprise integrated something-or-other? Is there any particular reason you aren't using whatever i18n framework your tool chain supports (gettext, .NET resource files...)?
In general I'd say you want to separate out resources by culture (but to be honsest, fr_AU should be rare) to have better maintainability and do not have to load the entire file for all per-culture-versions in many situations. This is especially true if your number of supported languages/cultures goes into the dozens or more.
However, it would be important to accommodate XML schema changes. The XML could be auto-generated, from simpler structures (key-value, either in a database or files) and validated via a common schema.
This is whether (as commenters noted) you are providing localized products or customers can create their own localizations.
In general, you should consider existing tools, rather than start from the scratch.
In .net we are using Data Driven ASP.NET Localization
Resource Provider and Editor Created by rick strahl

Resources