EXIficient / exificient-grammars

Java Implementation of EXI (grammars part)
http://exificient.github.io/java/
MIT License
4 stars 9 forks source link

Serializing EXI grammars #17

Open danielpeintner opened 1 year ago

danielpeintner commented 1 year ago

Serializing the grammar to XML, or to JSON would likely solve my problem. I will investigate per the links you provided.

A standard and portable form for these grammars would be nice, but is not required, nor do we need the serialization of the grammar to be reusable across versions of Exificient nor versions of Java.

There are actually two reasons why a serialized grammar is needed.

(1) performance - the penalty of converting a large XSD into a grammar at startup

(2) resolver - eliminate the need to have multiple things to use the schema-aware EXI file: (a) entire schema and (b) software linked to our URI resolver (Apache Daffodil has a specific resolver that uses XML Catalogs, relative paths, and classpath search of directories/jars - which enables packaging XSD schemas into jar files like any reusable software module.)

Originally posted by @mbeckerle in https://github.com/EXIficient/exificient-core/issues/8#issuecomment-1314060917

danielpeintner commented 1 year ago

(1) performance - the penalty of converting a large XSD into a grammar at startup

You may want to try it out but my guess is that there is not much difference. Feel free to provide some tests / measurements

(2) resolver - eliminate the need to have multiple things to use the schema-aware EXI file: (a) entire schema and (b) software linked to our URI resolver (Apache Daffodil has a specific resolver that uses XML Catalogs, relative paths, and classpath search of directories/jars - which enables packaging XSD schemas into jar files like any reusable software module.)

I am not sure whether I fully understand this problem description / concern. Yes, you might be able to reduce dependency (like removing the xerces jar) and you may alo want to pack the XSDs in the classpath to avoid loading files e.g., from the web but I think this is all doable ..

@mbeckerle Note: we will not have the time to actually work on this feature in the near future without external support.. I am happy to take a look at your work.

mbeckerle commented 1 year ago

@danielpeintner Understood. There's a chance we'll be able to contribute something eventually. Right now the other ticket about maxOccurs="999" (or other large value that is not "unbounded") is a much higher priority issue for us.