Hi,
I have the following xml file
<?xml version="1.0" encoding="UTF-8" ?>
<n1:Message xmlns:n1="nz:govt:moh:schemas:diabetes-cardio.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<MessageHeader>
<Site>pho1diab</Site>
<SendingApplication>MyPracticePMS 8.05a</SendingApplication>
<SendingFacility>PracticeName or HeathLinkMailBox</SendingFacility>
<ReceivingApplication>Diabetes/CVD v2</ReceivingApplication>
<ReceivingFacility>pho1diab</ReceivingFacility>
<CreationDateTime>20060424132630</CreationDateTime>
<MessageType>DBT_DAT</MessageType>
<MessageSpecificationVersion>002</MessageSpecificationVersion >
<MessageID>message 123456</MessageID >
<ProcessingID>P</ProcessingID >
<OtherParameters>OtherParameters go here</OtherParameters>
</MessageHeader>
and the following xsd file as
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" >
<xs:element name="Message">
<xs:complexType>
<xs:sequence>
<xs:element name="MessageHeader" type="MessageHeaderType"/>
<xs:element name="MessageBody" type="MessageBodyType"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="MessageHeaderType">
<xs:sequence>
<xs:element name="SendingApplication">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="20"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="SendingFacility">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="30"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="ReceivingApplication" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="20"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="ReceivingFacility">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="30"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="CreationDateTime" type="xs:dateTime"/>
<xs:element name="MessageID">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="20"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="MessageType" type="MessageTypeType"
fixed="CVD_DAT"/>
<xs:element name="ProcessingID">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="1"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="MessageTypeType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="Version" type="xs:string" use="required"
fixed="2.0"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
How to validate each text contained in the xml file against the xsd
file i.e the data type each text should be correct as well as to check
each required attribute is present or not. can anybody suggest me the
solution
*** Sent via Developersdex
http://www.developersdex.com ***