Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
need help for xml
#1
XML
can some one please guide me through this one . I am trying to make an xml from the data below .
Drug XML
Create an XML structure that describes a set of drugs and the possible dosages they might have based on the table below.
Create an element named <drug> for each drug entry.
Make the name, dosage, units, and cost attributes of each drug. Note that the cost is the cost per pill rather than the cost mg.
Make the count the text for that drug element.
Name Dosage Units Cost Count
Asprin 100 mg 0.10 320
Asprin 200 mg 0.15 211
Digoxin 10 mL 1.22 19
Digoxin 20 mL 2.01 27
Below is my code
`import xml.etree.ElementTree as xml
drugs = """<?xml version="1.0"?>
<drugs>
<drug1 Name="Aspirin" Dosage ="100" Units="mg" Cost= "0.10">
Count = 320
</start>
<drug1 Name="Aspirin" Dosage ="200" Units="mg" Cost= "0.15">
Count =211
</start>
<drug1 Name="Digoxin" Dosage ="10" Units="mL" Cost= "1.22">
Count =19

</start>
<drug1 Name="Digoxin" Dosage ="20" Units="mL" Cost= "2.01">
Count =27

</start>



</drugs>
"""
` I am not very sure is it correct or not .Please guide me .
Thanks
Reply


Messages In This Thread
[split] xml (from json) - by just_started_python - Oct-31-2016, 05:19 PM
RE: need help for xml - by micseydel - Oct-31-2016, 08:18 PM
RE: need help for xml - by micseydel - Nov-01-2016, 02:22 AM
RE: need help for xml - by just_started_python - Nov-01-2016, 03:34 PM
RE: need help for xml - by metulburr - Nov-01-2016, 03:43 PM
RE: need help for xml - by micseydel - Nov-01-2016, 04:07 PM
RE: need help for xml - by nilamo - Nov-07-2016, 07:17 PM
RE: [split] xml (from json) - by micseydel - Oct-31-2016, 06:35 PM
need help for xml - by just_started_python - Oct-31-2016, 08:13 PM
need help for xml - by just_started_python - Nov-01-2016, 02:10 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020