Monday, 15 July 2013

XML DTD and Schema

XML

Here is the XML file of Miss Aisha Khan

Note : This is Program not Presentation or PDF Kindly Understand the code and Work. Paste in NOTEPAD and save it with .xml extension.

XML

 <?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE>
<student>
<id>1</id>
<name>Owais</name>
<enroll_no>1207G1</enroll_no>
</student>

DTD XML

 <?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE student [
<!ELEMENT student  (id,name,enroll_no)>
<!ELEMENT id  (#PCDATA)>
<!ELEMENT name  (#PCDATA)>
<!ELEMENT enroll_no  (#PCDATA)>
]>
<student>
<id>1</id>
<name>Owais</name>
<enroll_no>1207G1</enroll_no>
</student>

Schema

<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs=http://www.w3.org/2001/XMLSchema> <!--xmlns means XML NameSpace-->
<xs:element name="price">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:decimal">
<xs:attribute name="currency" type="xs:string" use="required"></xs:attribute>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:schema>

0 comments:

Post a Comment

 
;