100 likes | 229 Views
Health Care Analyst A. 0. Source Data: John Doe. Analyze, XMLize. 1. Context: Hospital Patient Record. Proposed Tag: <Patient>. <?xml version=“1.0” ?> <Patient>John Doe</Patient>. 2. Well-formed XML document. Health Care Analyst B. 0. Source Data: John Doe. Analyze, XMLize. 1.
E N D
Health Care Analyst A 0 Source Data:John Doe Analyze, XMLize 1 Context:Hospital Patient Record Proposed Tag: <Patient> <?xml version=“1.0” ?> <Patient>John Doe</Patient> 2 Well-formed XML document
Health Care Analyst B 0 Source Data:John Doe Analyze, XMLize 1 Context:Hospital Patient Record Proposed Tag: <InPatient> <?xml version=“1.0” ?> <InPatient>John Doe</InPatient> 2 Well-formed XML document Problem: Same data, same context, different XMLization
VALIDATION – Exercising Control over your Data Schemas provide a means for specifying your entire XML ‘vocabulary’. Because they are written in XML they can be processed just like any other XML document. <?xml version="1.0"?> <Patient>John Doe</Patient> <?xml version="1.0"?> <xs:schema xmlns:xsd=http://www.w3.org/2001/XMLSCHEMA> <xs:element name="Patient" type="xs:string"/> </xs:schema>
<?xml version="1.0"?> <HospitalizationRecord> <Client>John Doe</Client> <Date>18-FEB-04</Date> <Comment>Patient showed severe malnutrition</Comment> </HospitalizationRecord> <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> <xs:element name="HospitalizationRecord"> <xs:complexType> <xs:sequence> <xs:element name="Client" type="xs:string"/> <xs:element name="Comment" type="xs:string"/> <xs:element name="Date" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:element> </xs:schema>
<?xml version="1.0"?> <HospitalizationRecord> <Client>John Doe</Client> <Date>18-FEB-04</Date> <Comment>Patient showed severe malnutrition</Comment> </HospitalizationRecord> <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> <xs:element name="Client" type="xs:string"/> <xs:element name="Comment" type="xs:string"/> <xs:element name="Date" type="xs:string"/> <xs:element name="HospitalizationRecord"> <xs:complexType> <xs:sequence> <xs:element ref="Client"/> <xs:element ref="Date"/> <xs:element ref="Comment"/> </xs:sequence> </xs:complexType> </xs:element> </xs:schema>
In-Class Exercise Write the XSD for the following XML document: <?xml version="1.0"?> <Case> <Physician>Dr. Alberts</Physician> <Date>18-FEB-04</Date> <Patient>John Doe</Patient> <Diagnosis>Diabetes</Diagnosis> <Insurance>Kaiser Permanente</Insurance> </Case>