Is there any standard way to pare a DFDL file using Java. Currently we have a Java program which uses XML files. Now we also want to be able to parse DFDL files. Is there anyway to this in Java? Is there any way to do this with the DFDL and no schema? I've read some things about the difference between DFDL and XML. Is there any I can treat them the the same in Java. Thank...............................!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Asked
Active
Viewed 1,145 times
0
-
I'm not familiar with DFDL files although there does appear to be a (at least one) library for parsing DFDL files (google "Java DFDL parser"). In terms of "treating them the same", it depends on how "same" you are talking about. I once had to take either CSV or XML files and add entries to a database. Adding the entries was the same, but parsing the XML vs. CSV files was different. So you can create an abstract class that can be extended by either an XML parser or a DFDL parser, but I highly doubt parsing will be similar. – Jared Nov 04 '14 at 01:31
-
I looked at the 'Dafodil' parser and downloaded it. This is what it says it does :Daffodil is a parser generator that follows the DFDL specification. This to me sounds like it parse a file like a .csv and save it in DFDL format. That's not what I want. I want to load a DFDL file in Java and have the abilty to access the data in Java. The generated parsers will translate into XML files that follow the format described by an XML Schema with DFDL annotations. It is a command line tool and a Java/Scala library. – user3470688 Nov 04 '14 at 13:15
1 Answers
0
Try IBM DFDL's Java implementation. You need to download IBM Integration Bus Developer Edition, and extract the jars (documentation explains how to do this). It comes with a SAX sample that makes IBM DFDL look like a SAXReader and you get SAX events to your docHandler callback. It's great for making non-XML data look like XML.

Steve Hanson
- 96
- 4
-
any idea how to set the parser's prefix attribute to something we need? I mean we can set the rootelement but not the prefix. – JackSlayer94 Sep 21 '17 at 13:44