gudii9
asked on
XML based on XSD
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.gp.com/Patient"
xmlns:tns="http://www.gp.com/Patient" elementFormDefault="qualified">
<element name="patient" type="tns:Patient" />
<complexType name="Patient">
<sequence>
<element name="id" type="tns:ID" />
<element name="name" type="tns:string15chars" />
<element name="age" type="int" />
<element name="dob" type="date" />
<element name="email" type="string" />
<element name="gender" type="tns:genderEnum" />
<element name="phone" type="string" />
</sequence>
</complexType>
<simpleType name="ID">
<restriction base="int">
<pattern value="[0-9]*"></pattern>
</restriction>
</simpleType>
<simpleType name="string15chars">
<restriction base="string">
<pattern value="15"></pattern>
</restriction>
</simpleType>
<simpleType name="genderEnum">
<restriction base="string">
<enumeration value="M"/>
<enumeration value="F"/>
</restriction>
</simpleType>
</schema>
Based on aboveXSD i generated below XML which gives error at line 4 of XML as
Multiple annotations found at this line:
- cvc-type.3.1.3: The value 'Maaa' of element 'tns:name' is not valid.
- cvc-pattern-valid: Value 'Maaa' is not facet-valid with respect to pattern '15' for type
'string15chars'.
<?xml version="1.0" encoding="UTF-8"?>
<tns:patient xmlns:tns="http://www.gp.com/Patient" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.gp.com/Patient Patient.xsd ">
<tns:id>1</tns:id>
<tns:name>Maaa</tns:name>
<tns:age>0</tns:age>
<tns:dob>2001-01-01</tns:dob>
<tns:email>tns:email</tns:email>
<tns:gender>M</tns:gender>
<tns:phone>tns:phone</tns:phone>
</tns:patient>
why i am getitng this error and how to fix it. i using eclipse for this as IDE.
any other open source XML IDEs bettr than eclipse to work on these simple xml, XSDs etc
please advise
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
it is all there, complete and correct, lacking feedback sadly