Archive

Posts Tagged ‘DTD’

WST Assignment #3


This third assignment has given me a lot of experiences the very first impact is that, we have to use the C#and ISS server(to which I’m unfamiliar). By now you would have understood that I might have used SQL server database as back end(Yes).
The second experience is that power of the Visual Basic editor, it has a lot of support for the developer, makes the things much easier.
People most of the times get scared of XSD(XML Schema Definition) successor of the DTD but it is very easy to write. I would like to share the XSD file I wrote for this assignment. It is very simple and easy to understand.

 

<?xml version=”1.0″ encoding=”Windows-1252″?>
<xs:schema attributeFormDefault=”unqualified” elementFormDefault=”qualified” xmlns:xs=”http://www.w3.org/2001/XMLSchema”&gt;
<xs:element name=”Profile”>
<xs:complexType>
<xs:sequence>

<xs:element name=”Name”>
<xs:simpleType>
<xs:restriction base=”xs:string”>
<xs:pattern value=”([a-zA-Z ])+”/>
</xs:restriction>
</xs:simpleType>
</xs:element>

<xs:element name=”RollNo”>
<xs:simpleType>
<xs:restriction base=”xs:string”>
<xs:pattern value=”([a-zA-Z0-9])+”/>
</xs:restriction>
</xs:simpleType>
</xs:element>

<xs:element name=”PhoneNo”>
<xs:simpleType>
<xs:restriction base=”xs:string”>
<xs:length value=”13″/>
<xs:pattern value=”[+]([0-9])*”>
</xs:pattern>
</xs:restriction>
</xs:simpleType>
</xs:element>

<xs:element name=”Email”>
<xs:simpleType>
<xs:restriction base=”xs:string”>
<xs:pattern value=”\w+([\-\+\.’]\w+)*@\w+([\-.]\w+)*\.\w+([\-.]\w+)*”>
</xs:pattern>
</xs:restriction>
</xs:simpleType>
</xs:element>

<xs:element name=”CollegeAddress”>
<xs:complexType>
<xs:sequence>
<xs:element name=”RoomNo” type=”xs:string” />
<xs:element name=”Hostel” type=”xs:string” />
<xs:element name=”College” type=”xs:string” />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name=”PermanentAddress”>
<xs:complexType>
<xs:sequence>
<xs:element name=”H.No” type=”xs:string” />
<xs:element name=”Town” type=”xs:string” />
<xs:element name=”Dist” type=”xs:string” />
<xs:element name=”State” type=”xs:string” />
<xs:element name=”Pin” >
<xs:simpleType>
<xs:restriction base=”xs:string”>
<xs:length value=”6″/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name=”Interests” type=”xs:string” />
<xs:element name=”Hobbies” type=”xs:string” />
<xs:element name=”AboutMe” type=”xs:string” />
<xs:element name=”Image” type=”xs:string” />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

 

 

I’ve used \w+([\-\+\.’]\w+)*@\w+([\-.]\w+)*\.\w+([\-.]\w+)* this for the email pattern. If my email pattern written in .xm. is file is not of this regular expression XSD file shows errors in the validation. For this XML validation I used the validateXML-1.1-bin.jar file. In order to validate the XML file using the validateXML-1.1-bin.jar validator we should use the following tag in the  present XML file
<Profile xsi:noNamespaceSchemaLocation=”profile.xsd” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”&gt;

in the above syntax the profile specifies the root element of the XML file. The profile.xsd specifies the .xsd file we want to apply to that.

the validation command to work with it is:

java -jar validateXML-1.1-bin.jar   -in profile.xml

 

Advertisements

My first video ever I uploaded to Youtube!!


This is the first video which I’ve ever uploaded to Youtube. This video gives brief idea about the various technologies, XML, XHTML,XSL, XSLT, XSD, Schema, DTD, Validation, Stylesheets (CSS)., RSS, DOM which constitute a very complex web sites.