Re: [xml-dev] A success story … using DFDL to pars e (and unparse) air navigation data
Kit <[email protected]> Fri, 14 Apr 2023 22:29:55 +0200
| Newsgroups | gmane.text.xml.devel |
|---|---|
| Message-ID | <CAAVKVq_Hd3-Qo5ixFpW5wpW_tuLVpD1WHAr6s2xd3f4UN_dtNQ@mail.gmail.com> |
An alternative could be this:
<Runway
GLS_Channel="20abc"
Identifier="RW25R"
Latitude="N82091570"
Longitude="E156450340"
/>
--
Kit
pá 14. 4. 2023 v 19:13 odesílatel Roger L Costello <[email protected]> napsal:
>
> Hi Folks,
>
> I created a parser to parse air navigation data (air nav data is the data that is loaded into the aircraft’s computer to enable it to fly the aircraft). The parser is completely declarative, i.e., it has no code. The parser is specified using the DFDL language, which is a simple extension of XML Schema. Here is an excerpt of the DFDL schema that I wrote:
>
> <xs:element name="GLS_Channel" type="validString" dfdl:lengthKind="explicit" dfdl:length="5" />
> <xs:element name="Runway_Identifier" type="validString" dfdl:lengthKind="explicit" dfdl:length="5" />
> <xs:element name="Station_Latitude" type="validString" dfdl:lengthKind="explicit" dfdl:length="9" />
> <xs:element name="Station_Longitude" type="validString" dfdl:lengthKind="explicit" dfdl:length="10" />
>
> Notice how declarative it is. It specifies “what” data fields are in the air nav document, not “how” to parse its data fields. That, in my opinion, is a huge benefit.
>
> I fed the air nav file into the Apache open-source DFDL processor (Daffodil), along with my DFDL schema. I instructed the DFDL processor to serialize the parsed air nav data to XML:
>
> I could have instructed the DFDL processor to serialize the parsed air nav data to JSON or to EXI (binary XML, i.e., super-compact XML) or to a number of other formats.
>
> The XML document that parsing produced is highly readable. Here is an excerpt of the XML output:
>
> <GLS_Channel>20abc</GLS_Channel>
> <Runway_Identifier>RW25R</Runway_Identifier>
> <Station_Latitude>N82091570</Station_Latitude>
> <Station_Longitude>E156450340</Station_Longitude>
>
> Notice how readable it is. And, of course, the XML document is highly processable. The entire XML suite of technologies may be used to process it.
>
> In addition to the advantages just listed, DFDL also has the advantage of unparsing. Thus, I was also able to unparse the XML:
>
> Here are some interesting statistics:
>
> Size of the AirNav.dat file is 375 MB
> Size of the XML file that DFDL parsing produced is 4.67 GB
> Recall I said that the DFDL processor can output many different formats, one being EXI (binary XML). I did that and the resulting output is nearly as small as the original air nav text file. The size of the EXI file is 384 MB
>
> /Roger
_______________________________________________________________________
XML-DEV is a publicly archived, unmoderated list hosted by OASIS
to support XML implementation and development. To minimize
spam in the archives, you must subscribe before posting.
[Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
Or unsubscribe: [email protected]
subscribe: [email protected]
List archive: http://lists.xml.org/archives/xml-dev/
List Guidelines: http://www.oasis-open.org/maillists/guidelines.php