Parse_xml - ObjectVision/GeoDMS GitHub Wiki
File, Folder and Read functions parse_xml
- parse_xml(string_dataitem, xml_scheme)
parse_xml(string_dataitem, xml_scheme) parses the contents of the argument string_dataitem with XML data into a set of configured attributes, based on the xml_scheme argument.
- data item string_dataitem with value type string
- template xml_scheme, with xml scheme information for the string_dataitem.
The template used as second argument of the parse_xml function may not contain any expression. If calculations are needed, configure them outside the scope of the template.
attribute<string> FileName(File): ['9999OPR08012016-000001.xml','9999OPR08012016-000003.xml'];
attribute<string> XmlData(File)
: StorageType = "strfiles"
, StorageName = "%SourceDataDir%/BAG";
template scheme
{
unit<uint32> bag_LVC_OpenbareRuimte
{
attribute<string> bag_LVC_identificatie;
attribute<string> bag_LVC_OpenbareRuimteNaam;
attribute<string> bag_LVC_openbareRuimteType;
unit<uint32> bag_LVC_gerelateerdeWoonplaats
{
attribute<string> bag_LVC_identificatie;
}
attribute<string> bag_LVC_openbareruimteStatus;
attribute<string> bag_LVC_aanduidingRecordInactief;
attribute<string> bag_LVC_aanduidingRecordCorrectie;
attribute<string> bag_LVC_officieel;
attribute<string> bag_LVC_inOnderzoek;
attribute<string> bagtype_begindatumTijdvakGeldigheid;
attribute<string> bagtype_einddatumTijdvakGeldigheid;
attribute<string> bagtype_documentdatum;
attribute<string> bagtype_documentnummer;
}
}
container ParsedXML := parse_xml(XmlData, scheme);
unit<uint32> gerelateerdeWoonplaats := ParsedXML/bag_LVC_OpenbareRuimte/bag_LVC_gerelateerdeWoonplaats
{
attribute<string> identificatie := bag_LVC_identificatie;
attribute<gerelateerdeWoonplaats> openbareruimte_rel := value(Parent_rel, ParsedXML/bag_LVC_OpenbareRuimte);
}
This example parses two OpenbareRuimte files from the BAG into a set of attributes for GeoDMS domain units.
A parse_xml runs on a worker thread, and several of them run side by side when they are demanded together. They are not demanded together when each parse feeds its own storage and the storages are listed as ExplicitSuppliers: those are written one after another, each parse waited for before the next is started. A chain of do calls over one parsed attribute per file set, named before the storage in each driver, demands the parses at once; see the example on the Do page.