ten.parse_xml(s)
Return 1010data's intermediate form (IF) from a Macro Language XML query.
Note: This function is for advanced users.
Syntax
ten.parse_xml(s)
Arguments
s
- A string representing a Macro Language query.
Returns
1010data's intermediate form or IF.
Example
<base table="default.lonely"/>
<code language_="python">
<![CDATA[
import json
base_intermediate_form_a = ten.parse_xml('<base table="default.test.solar"/>')
base_intermediate_form_b = [['base',{'table':b'default.test.solar'},[]]]
sel_intermediate_form_a = ten.parse_xml('<sel value="type = \'planet\'"/>')
sel_intermediate_form_b = [['sel',{'value':b'type = \'planet\''},[]]]
is_base_same = base_intermediate_form_a == base_intermediate_form_b
is_sel_same = sel_intermediate_form_a == sel_intermediate_form_b
repr_base = repr(base_intermediate_form_b)
repr_sel = repr(sel_intermediate_form_b)
repr_qry = repr(base_intermediate_form_b + sel_intermediate_form_b)
df = pd.DataFrame({'is_sel_same':[is_sel_same],
'is_base_same':[is_base_same],
'repr_base':[repr_base],
'repr_sel': [repr_sel],
'repr_qry': [repr_qry]
})
ops = ten.rebase(df)
]]>
</code>
This example
shows two ways to return the intermediate form from two Macro Language queries. "Form a"
uses the ten.parse_xml()
function. The repr_qry
column displays the intermediate form of the base query (<base
table="default.test.solar"/>
) and the select query (<sel
value="type = \'planet\'"/>
).