I need to render the recursive xml through xml itself


#1

I have written code like this.

<StackLayout xmlns:drugLayouts="~/views/drug/drug-layouts">
    <StackLayout class="{{children ? 'dosing-item': 'no-dosing-item'}}" visibility = "{{ value ? 'visible':'collapse' }}">
        <Label class="dosage-item-text font-22 notoSans-bold" text="{{ label }}"/>
        <Repeater items="{{ value }}">
            <Repeater.itemTemplate>
                <Label textWrap="true" class="dosage-item-text font-22" text="{{ $value }}" />
            </Repeater.itemTemplate>
        </Repeater>
    </StackLayout>
    <StackLayout class="drug-details-wrapper" visibility="{{ children ? 'visible':'collapse' }}">
        <Repeater items="{{children}}">
            <Repeater.itemTemplate>
                <drugLayouts:common-render/>
            </Repeater.itemTemplate>
        </Repeater>
    </StackLayout>
</StackLayout>

The json I am having :

[
{
“drug_name”: “mixed grass pollens allergen extract”,
“drug_attribute_id”: 32978,
“level”: 1,
“label”: “Description”,
“value”: null,
“value_type”: “TEXT”,
“parent_id”: null,
“seq_id”: 2,
“show”: false,
“children”: null
},
{
“drug_name”: “mixed grass pollens allergen extract”,
“drug_attribute_id”: 32985,
“level”: 1,
“label”: “Adult Dosing”,
“value”: null,
“value_type”: “TEXT”,
“parent_id”: null,
“seq_id”: 3,
“show”: false,
“children”: [
{
“drug_name”: “mixed grass pollens allergen extract”,
“drug_attribute_id”: 32996,
“level”: 3,
“label”: “Dosage forms”,
“value”: [
“300 index of reactivity SL tab”
],
“value_type”: “TEXT”,
“parent_id”: 32985,
“seq_id”: 1,
“children”: null
},
{
“drug_name”: “mixed grass pollens allergen extract”,
“drug_attribute_id”: 32997,
“level”: 3,
“label”: “allergic rhinitis, grass pollen-induced”,
“value”: [
“[18-65 yo]\nDose: 300 index of reactivity SL qd until end of pollen season; Start: 4mo before pollen season”
],
“value_type”: “TEXT”,
“parent_id”: 32985,
“seq_id”: 2,
“children”: null
},
{
“drug_name”: “mixed grass pollens allergen extract”,
“drug_attribute_id”: 32998,
“level”: 3,
“label”: “renal dosing”,
“value”: [
“[not defined]”
],
“value_type”: “TEXT”,
“parent_id”: 32985,
“seq_id”: 3,
“children”: null
},
{
“drug_name”: “mixed grass pollens allergen extract”,
“drug_attribute_id”: 32999,
“level”: 3,
“label”: “hepatic dosing”,
“value”: [
“[not defined]”
],
“value_type”: “TEXT”,
“parent_id”: 32985,
“seq_id”: 4,
“children”: null
}
]
},
{
“drug_name”: “mixed grass pollens allergen extract”,
“drug_attribute_id”: 32986,
“level”: 1,
“label”: “Pediatric dosing”,
“value”: null,
“value_type”: “TEXT”,
“parent_id”: null,
“seq_id”: 4,
“show”: false,
“children”: [
{
“drug_name”: “mixed grass pollens allergen extract”,
“drug_attribute_id”: 33000,
“level”: 3,
“label”: “Dosage forms”,
“value”: [
“100,300 index of reactivity SL tab”
],
“value_type”: “TEXT”,
“parent_id”: 32986,
“seq_id”: 1,
“children”: null
},
{
“drug_name”: “mixed grass pollens allergen extract”,
“drug_attribute_id”: 33001,
“level”: 3,
“label”: “allergic rhinitis, grass pollen-induced”,
“value”: [
“[>10 yo]\nDose: 100 index of reactivity SL qd x1 day, then 200 index of reactivity SL qd x1 day, then 300 index of reactivity SL qd until end of pollen season; Start: 4mo before pollen season”
],
“value_type”: “TEXT”,
“parent_id”: 32986,
“seq_id”: 2,
“children”: null
},
{
“drug_name”: “mixed grass pollens allergen extract”,
“drug_attribute_id”: 33002,
“level”: 3,
“label”: “renal dosing”,
“value”: [
“[not defined]”
],
“value_type”: “TEXT”,
“parent_id”: 32986,
“seq_id”: 3,
“children”: null
},
{
“drug_name”: “mixed grass pollens allergen extract”,
“drug_attribute_id”: 33003,
“level”: 3,
“label”: “hepatic dosing”,
“value”: [
“[not defined]”
],
“value_type”: “TEXT”,
“parent_id”: 32986,
“seq_id”: 4,
“children”: null
}
]
},
{
“drug_name”: “mixed grass pollens allergen extract”,
“drug_attribute_id”: 32980,
“level”: 1,
“label”: “Black Box Warnings”,
“value”: null,
“value_type”: “LIST”,
“parent_id”: null,
“seq_id”: 5,
“show”: false,
“children”: [
{
“drug_name”: “mixed grass pollens allergen extract”,
“drug_attribute_id”: 32987,
“level”: 2,
“label”: “Severe Hypersensitivity Rxn”,
“value”: [
“life-threatening rxns incl. anaphylaxis and severe laryngopharyngeal restriction may occur; do not give to pts w/ severe, unstable or uncontrolled asthma; tx may not be suitable for pts w/ underlying medical conditions that may decr. ability to survive serious hypersens. rxns; observe pts for s/sx hypersensitivity rxn for at least 30min after 1st dose; prescribe auto-injectable epinephrine and instruct pts on appropriate use and to seek immed. medical care upon use; allergen immunotherapy may not be suitable for pts potentially unresponsive to epinephrine or inhaled bronchodilators, such as pts taking beta-blockers”
],
“value_type”: “TEXT”,
“parent_id”: 32980,
“seq_id”: 1,
“children”: null
}
]
},
{
“drug_name”: “mixed grass pollens allergen extract”,
“drug_attribute_id”: 32981,
“level”: 1,
“label”: “Contraindications/Cautions”,
“value”: [
" hypersens. to drug/class/compon.\n",
" severe, unstable or uncontrolled asthma\n",
" eosinophilic esophagitis hx\n",
" unhealed oral wounds or inflammation\n",
" caution if concomitant allergen immunotherapy"
],
“value_type”: “LIST”,
“parent_id”: null,
“seq_id”: 6,
“show”: false,
“children”: null
},
{
“drug_name”: “mixed grass pollens allergen extract”,
“drug_attribute_id”: 32982,
“level”: 1,
“label”: “Adverse Reactions”,
“value”: null,
“value_type”: “TEXT”,
“parent_id”: null,
“seq_id”: 7,
“show”: false,
“children”: [
{
“drug_name”: “mixed grass pollens allergen extract”,
“drug_attribute_id”: 32988,
“level”: 2,
“label”: “Serious reactions”,
“value”: [
" hypersensitivity rxn\n",
" anaphylaxis\n",
" laryngopharyngeal edema\n",
" eosinophilic esophagitis"
],
“value_type”: “LIST”,
“parent_id”: 32982,
“seq_id”: 1,
“children”: null
},
{
“drug_name”: “mixed grass pollens allergen extract”,
“drug_attribute_id”: 32989,
“level”: 2,
“label”: “Common Reactions”,
“value”: [
" pruritus\n",
" throat irritation\n",
" oral edema\n",
" cough\n",
" asthma (peds pts)\n",
" tonsillitis (peds pts)\n",
" oropharyngeal pain\n",
" oral paresthesia\n",
" abdominal pain\n",
" dyspepsia\n",
" atopic dermatitis (peds pts)\n",
" URI (peds pts)\n",
" pharyngeal edema\n",
" tongue swelling\n",
" dysphonia (peds pts)\n",
" urticaria\n",
" oral hypoesthesia\n",
" stomatitis"
],
“value_type”: “LIST”,
“parent_id”: 32982,
“seq_id”: 2,
“children”: null
}
]
},
{
“drug_name”: “mixed grass pollens allergen extract”,
“drug_attribute_id”: 32983,
“level”: 1,
“label”: “Safety and Monitoring”,
“value”: null,
“value_type”: “TEXT”,
“parent_id”: null,
“seq_id”: 8,
“show”: false,
“children”: [
{
“drug_name”: “mixed grass pollens allergen extract”,
“drug_attribute_id”: 32990,
“level”: 2,
“label”: “Pregnancy”,
“value”: [
“[B]\r\nAnimal studies show no risk or adverse fetal effects but controlled human 1st trimester studies not avail/do not confirm; no evidence of 2nd or 3rd trimester risk; fetal harm possible but unlikely; see pkg insert drug-specific recs”
],
“value_type”: “TEXT”,
“parent_id”: 32983,
“seq_id”: 1,
“children”: null
},
{
“drug_name”: “mixed grass pollens allergen extract”,
“drug_attribute_id”: 32991,
“level”: 2,
“label”: “Lactation”,
“value”: [
“[Safety Unknown]\r\nInadequate literature available to assess risk; caution advised”
],
“value_type”: “TEXT”,
“parent_id”: 32983,
“seq_id”: 2,
“children”: null
},
{
“drug_name”: “mixed grass pollens allergen extract”,
“drug_attribute_id”: 32992,
“level”: 2,
“label”: “Monitoring parameters”,
“value”: [
“s/sx hypersensitivity rxn for at least 30min after 1st dose”
],
“value_type”: “TEXT”,
“parent_id”: 32983,
“seq_id”: 3,
“children”: null
}
]
},
{
“drug_name”: “mixed grass pollens allergen extract”,
“drug_attribute_id”: 32984,
“level”: 1,
“label”: “Pharmacology”,
“value”: null,
“value_type”: “TEXT”,
“parent_id”: null,
“seq_id”: 9,
“show”: false,
“children”: [
{
“drug_name”: “mixed grass pollens allergen extract”,
“drug_attribute_id”: 32993,
“level”: 2,
“label”: “Metabolism”,
“value”: [
“unknown; CYP450: unknown”
],
“value_type”: “TEXT”,
“parent_id”: 32984,
“seq_id”: 1,
“children”: null
},
{
“drug_name”: “mixed grass pollens allergen extract”,
“drug_attribute_id”: 32994,
“level”: 2,
“label”: “Excretion”,
“value”: [
“unknown; Half-life: unknown”
],
“value_type”: “TEXT”,
“parent_id”: 32984,
“seq_id”: 2,
“children”: null
},
{
“drug_name”: “mixed grass pollens allergen extract”,
“drug_attribute_id”: 32995,
“level”: 2,
“label”: “Mechanism of Action”,
“value”: [
“exact mechanism of action unknown; alters immune response and promotes tolerance through repeated allergen-specific exposure”
],
“value_type”: “TEXT”,
“parent_id”: 32984,
“seq_id”: 5,
“children”: null
}
]
},
{
“drug_name”: “mixed grass pollens allergen extract”,
“drug_attribute_id”: 32977,
“level”: 1,
“label”: “Interaction Characteristics”,
“value”: null,
“value_type”: “TEXT”,
“parent_id”: null,
“seq_id”: 100,
“show”: false,
“children”: null
}
]