[DFDL-WG] DFDL Meta-schema

Mike Beckerle mbeckerle.dfdl at gmail.com
Thu May 7 10:22:35 EDT 2020


Marcos,

We use this approach in Apache Daffodil (incubating).

We use the schemas donated by IBM. Slight modifications have happened since
them with new properties and such. We also created an XML schema for the
DFDL subset of XSD.

There are two things you need to make this work. One is the schemas
themselves. The other is a "resolver" which is a java class that finds and
provides the included/imported file names given namespace URIs, and
schemaLocation attributes. This resolver gets passed to Xerces. Your
application can get away with a very stripped down resolver. We do have a
full-featured one that you can use or learn from or adapt to your purposes.

One must still validate that short-form annotations are properly used, or
transform them into long form before validation. The schemas will check
that the dfdl prefix on things like dfdl:byteOrder="bigEndian" is valid and
that byteOrder is a allowed attribute name, but doesn't check that
dfdl:byteOrder="bigEndian" is placed on the right kind of XSD construct
where byteOrder is allowed.

Similarly the property-element form like:

      <dfdl:element><dfdl:property
name="byteOrder">bigEndian</dfdl:property></dfdl:element>

Also must be verified that the named property is relevant to the enclosing
annotation. Or you can transform to the long form instead before
validation. This requires escaping the value content.

If you clone the apache daffodil git repo, you can find schemas in

    daffodil-propgen/src/main/resources/ org/apache/daffodil/xsd - schemas
for the annotations (based on the ones originally created by IBM)

    daffodil-lib/src/main/resources/org/apache/daffodil/xsd -
XMLSchema_for_DFDL.xsd - Schema for the DFDL subset of XML Schema.

The resolver we created searches class paths to find schema files in jars
on the class path, or looks for an XML catalog. This is written in Scala.
It searches - (1) relative to current file containing the include/import
(2) relative to the root of each jar on the class path in order (3) in an
XML Catalog, found by way of a Catalog.properties file which itself is
searched for on the class path.  We have found (1) and (2) above very
helpful in building schemas up from other schemas packaged in jars.

It is in
daffodil-lib/src/main/scala/org/apache/daffodil/xml/DaffodilLoader.scala -
class DFDLCatalogResolver.

If you are using C/C++ code obviously this resolver will not apply, but
something like what it does may be needed.

-mike


Mike Beckerle | OGF DFDL Workgroup Co-Chair | Owl Cyber Defense |
www.owlcyberdefense.com
Please note: Contributions to the DFDL Workgroup's email discussions are
subject to the OGF Intellectual Property Policy
<http://www.ogf.org/About/abt_policies.php>



On Thu, May 7, 2020 at 5:09 AM Steve Hanson <smh at uk.ibm.com> wrote:

> Hi Marcos
>
> IBM donated its set of meta schemas to the WG a while back.  Mike may know
> where they are located, I can't see them anywhere.
>
> Regards
>
> Steve Hanson
>
> IBM Hybrid Integration, Hursley, UK
> Architect, *IBM DFDL*
> <http://www.ibm.com/developerworks/library/se-dfdl/index.html>
> Co-Chair, *OGF DFDL Working Group* <http://www.ogf.org/dfdl/>
> *smh at uk.ibm.com* <smh at uk.ibm.com>
> tel:+44-1962-815848
> mob:+44-7717-378890
> Note: I work Tuesday to Friday
>
>
>
> From:        "Marcos Bento (external)" <Marcos.Bento at esa.int>
> To:        dfdl-wg at ogf.org
> Date:        07/05/2020 08:38
> Subject:        [EXTERNAL] [DFDL-WG] DFDL Meta-schema
> Sent by:        "dfdl-wg" <dfdl-wg-bounces at ogf.org>
> ------------------------------
>
>
>
> Hi,
>
> I'm currently trying to find a way to automatically validate the schemas
> currently available/being developed in the scope of *DFDL4S*
> <http://eop-cfi.esa.int/index.php/applications/dfdl4s>.
> Is there an XSD that we could use as DFDL Meta-schema?
>
> The current proposed approach is to make a small standalone XercesC-based
> utility to make the validation.
> Do you have other/better suggestions?
>
> -Marcos
>
> --
> *HE Space for ESA - European Space Agency*
> Marcos Bento
> Mission Analysis Software Engineer
> System Support Division
> Earth Observation Projects Department
> Directorate of Earth Observation Programmes
>
> ESTEC
> Keplerlaan 1, PO Box 299
> NL-2200 AG Noordwijk, The Netherlands
> *marcos.bento at esa.int* <marcos.bento at esa.int> | *www.esa.int*
> <http://www.esa.int>
> T +31 71 565 3749
> This message is intended only for the recipient(s) named above. It may
> contain proprietary information and/or
> protected content. Any unauthorised disclosure, use, retention or
> dissemination is prohibited. If you have received
> this e-mail in error, please notify the sender immediately. ESA applies
> appropriate organisational measures to protect
> personal data, in case of data privacy queries, please contact the ESA
> Data Protection Officer (dpo at esa.int).
>
> --
>  dfdl-wg mailing list
>  dfdl-wg at ogf.org
>  https://www.ogf.org/mailman/listinfo/dfdl-wg
>
>
> Unless stated otherwise above:
> IBM United Kingdom Limited - Registered in England and Wales with number
> 741598.
> Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU
> --
>   dfdl-wg mailing list
>   dfdl-wg at ogf.org
>   https://www.ogf.org/mailman/listinfo/dfdl-wg
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ogf.org/pipermail/dfdl-wg/attachments/20200507/d00fe76b/attachment-0001.html>


More information about the dfdl-wg mailing list