AussieSilver
asked on
validation error
HI,
I have the attached two codes (xsd + xml).... once I validate the xml file I get the following error:
Message: An exception occurred! Type:RuntimeException, Message:Warning: The primary document entity could not be opened Id=/home/dml/medicare.xsd
--- can any one help me to crack this error?
Please have a look at the codes:
I have the attached two codes (xsd + xml).... once I validate the xml file I get the following error:
Message: An exception occurred! Type:RuntimeException, Message:Warning: The primary document entity could not be opened Id=/home/dml/medicare.xsd
--- can any one help me to crack this error?
Please have a look at the codes:
------xsd------
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="medicare-card">
<xs:complexType>
<xs:sequence>
<xs:element ref="expiry-date" />
<xs:element ref="family"/>
</xs:sequence>
<xs:attribute name="type" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Reciprocal"/>
<xs:enumeration value="Interim"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="id" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="[A-Z][0-9]{8}"></xs:pattern>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
<xs:unique name="unique-id">
<xs:selector xpath="medicare-card"></xs:selector>
<xs:field xpath="@id"></xs:field>
</xs:unique>
</xs:element>
<xs:element name="expiry-date" type="xs:date"/>
<xs:element name="family">
<xs:complexType>
<xs:sequence minOccurs="1" maxOccurs="9">
<xs:element ref="person"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="person">
<xs:complexType>
<xs:sequence>
<xs:element ref="name" />
<xs:element ref="date-of-birth" />
<xs:element ref="contact" />
<xs:element ref="medical-info" />
</xs:sequence>
<xs:attribute name="gender" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Male"/>
<xs:enumeration value="Female"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="name">
<xs:complexType>
<xs:sequence>
<xs:element name="lname" minOccurs="1" maxOccurs="1" />
<xs:element name="mname" minOccurs="0" maxOccurs="1" />
<xs:element name="fname" minOccurs="1" maxOccurs="1" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="date-of-birth" type="xs:date"/>
<xs:element name="contact">
<xs:complexType>
<xs:sequence>
<xs:element ref="address"/>
<xs:element name="telephone"/>
<xs:element name="email"/>
</xs:sequence>
<xs:attribute name="preferred">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="address"/>
<xs:enumeration value="telephone"/>
<xs:enumeration value="email"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="address">
<xs:complexType>
<xs:sequence>
<xs:element ref="street"/>
<xs:element ref="city"/>
<xs:element ref="state"/>
<xs:element ref="zipcode"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="street" type="xs:string"/>
<xs:element name="city" type="xs:string"/>
<xs:element name="state" type="xs:string"/>
<xs:element name="zipcode">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:pattern value="[0-9]{4}"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="medical-info">
<xs:complexType>
<xs:sequence>
<xs:element name="blood"/>
<xs:element ref="allergy"/>
<xs:element ref="chronic-illness"/>
</xs:sequence>
<xs:attribute name="type" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Opositive"/>
<xs:enumeration value="Onegative"/>
<xs:enumeration value="Apositive"/>
<xs:enumeration value="Anegative"/>
<xs:enumeration value="Bpositive"/>
<xs:enumeration value="Bnegative"/>
<xs:enumeration value="ABpositive"/>
<xs:enumeration value="ABnegative"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="allergy" type="xs:string"/>
<xs:element name="chronic-illness" type="xs:string"/>
</xs:schema>
---xml------
<?xml version="1.0" encoding="utf-8" ?>
<medicare xs:noNamespaceSchemaLocation="medicare.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance">
<medicare-card id="A12345678" type="Reciprocal">
<expiry-date>2020-12-12</expiry-date>
<family>
<person gender="Female">
<name >
<lname>Dabl</lname>
<mname>S</mname>
<fname>Norah</fname>
</name>
<date-of-birth>1987-07-21</date-of-birth>
<contact >
<address >
<street>Melbourne st.</street>
<city>Melbourne</city>
<state>vic</state>
<zipcode>3000</zipcode>
</address>
<telephone>0413074666</telephone>
<email>norah@email.com</email>
</contact>
<medical-info type="Opositive">
<blood></blood>
<allergy>no</allergy>
<chronic-illness>no</chronic-illness>
</medical-info>
</person>
</family>
</medicare-card>
</medicare>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Do you have the file medicare.xsd in the same path as the xml file?