Details
-
Improvement
-
Status: Unresourced
-
Not specified
-
Resolution: Unresolved
-
None
-
None
Description
Our current support for XML parsing via ECL language constructs is quite limited.
You must specify an xpath as entry point into elements you want to parse and the record definition must specify the attributes in those detected elements.
e.g.
rec := RECORD
string afieldUnknown macro: {xpath('Fields/afield')};
END;
ds := DATASET('~somexml', rec, XML('/Dataset/Row'));
That's okay, if the XML is well defined, pre-known structure and doesn't contain recursion, but you cannot parse arbitrary XML this way.
As a result, ECL users have been known to workaround this fact, by parsing XML as CSV, splicing it into flat records representing tags and depth.
We should discuss what ECL constructs/syntax would be sensible and what backend support would be useful, to parse arbitrary XML.
From an implementation point of view, I think it will need something that allows a SAX type approach, where you can hook new tags, new attributes etc and construct the rows/datasets you want.