Friday, 16 August 2013

XML Syllabus

 1                    XML Overview
2                    HTML VS XML
3                     Uses of XML
4                     XML Document Preparation Rules

1.       Element
2.       Attributes
3.       Entity

                                          SIMPLE ELEMENT
                    COMPLEX ELEMENT
2 XML Fundamentals
3 XML Namespace
4 XML Document Type Definitions
6 XML & XHTML; XML in Internet
7 Midterm Exam
8 XSLT
9 XPath
10 SAX, DOM
11 XLink, XPointer
12 XML and JAVA; JAXP, JAXB, JAXM
13 XML Applications
14 XML Case Study: Cocoon

Interview Questions


Web Technologies:

Schema for rules for creating student document

//Schema for rules for creating student document
<xs: schema xmlns:xs="http://www.w3.org/2001/xml schema">
    <xs: element name="institute">
      <xs:complexType>
        <xs: sequence>
           <xs:element name="rollno">
            <xs:simpleType>
              <xs: restriction base="xs:integer">
                <xs:pattern value="[0-9][0-9]"/>
                  <xs:restriction>
              <xs:simpleType>
                <xs:element>
                  <xs:element name="name">
                   <xs:simpleType>
                    <xs:restriction base="xs.string">
                     <xs: pattern value="([a-zA-Z])+"/>
                      <xs: minLength value="1"/>        
                       <xs:maxLength value="15"/>
                     </xs:restriction>
         
                    </xs:simpleType>
                </xs:element>
               <xs:element name=",pbo;emp" ,omPccirs="2" maxOcurs="5">
                <xs:simpletype>
                 <xs:restriction base="xs:integer">
                  <xs:pattern value="[0-9]{10}">
                 </xs:restriction>
                </xs:simpleType>
               </xs:element>
               <xs:element name="address">
                <xs:complexType>
                 <xs:all>
                  <xs:element name="hno" type="xs:String"/>
                  <xs:element name="colony" type="xs:string"/>
                  <xs:element name="city" type="xs:string"/>
                 </xs:all>
                 <xs:attribute name="state" type="xs:string" fixed="AP">
                </xs:complexType>
               </xs:element>
              </xs:sequence>
             </xs:attribute name="course">
            <xs:simpleType>
             <xs:restriction base="xs:string">
              <xs:enumeraion value="xml"/>
              <xs:enumeration value="java"/>
              <xs:enumeration value="html"/>
             </xs:restriction>
            </xs:simpleType>
           </xs:attribute>
          <xs:attribute name="type" type="xs:string" use="optional default="regular"/>
        </xs:complexType>
       </xs:element>
      </xs:sequence>
     </xs:complexType>
    </xs:element>
   </xs:schema>
  XML SCHEMA

Thursday, 15 August 2013

Rules for creating marcket using XML schema

<!rules for creating market using xml schema>
<xs:schema smlns:xs="http://www.w3.org/2001/xmlschema">
 <xs:element name="market">
  <xs:complexType>
   <xs:sequence>
        <xs:element name="product" minOccurs="1" MaxOccurs="10">
          <xs:complexType>
           <xs:all>
            <xs:element name="pid">
            <xs:simpleType>
             <xs:restriction base="xs:string">
              <xs:pattern value="[0-9a-zA-Z][0-9a-zA-Z]"/>
               </xs:restriction>      
                </xs:simpleType>
                 </xs:element>
                   </xs:element name="pname">
                    <xs:simpleType>
                     <xs:restriction base="xs:string">
                      <xs:pattern value="([0-9])+"/>
             </xs:restriction>
            </xs:simpleType>
          </xs:element>
        <xs:element name="desc" type="xs:string"/>
       </xs:all>
      <xs:attribute name="quantity" type="xs:integer" use="required">
      <xs:attribute name="type" type="xs.string" use="optional" default="retail">
      <xs:attribute name="barcode" type="xs:string"/>
     </xs:complexType>
    </xs:element>
   </xs:sequence>
  </xs:complexType>
 </xs:element>
</xs:schema>
Schema for Rules for creating Student document
       

Declaring an attribute

A simple element can not contain attributes, if an element contains attributes item it is considered as complex type.
Syntax:
      <xs: attribute name=”xxx” type=”yyy” />

Declaring an attribute with a fixed value

Syntax: <xs: attribute name=”xxx” type=”yyy” fixed=”value”/>

Declaring an attribute that is:  either optional (or) mandatory:

Syntax:
<xs: attribute name=”xxx” type=”yyy” use=”optional/required”/>

Restrictions:
To allow the user to type acceptable value for the XML elements. The restrictions on XML elements are called as facets.
What is a facet?
It allows the users to type acceptable value for the XML elements. These restrictions on XML elements are called facets.
Restrictions on range of values:
Syntax:
<xs: element name=”xxx”>
      <xs: simpleType>
         <xs: restriction base=”yyy”>
            <xs: mininclusive value=”minvalue”/>
            <xs: maxinclusive value=”maxvalue”/>
         </xs: restriction>
      </xs:simpleType>
</xs: element>
·         Instead of mininclusive and maxinclusive we can write minExclusive and MaxExclusive.
·         We can combine also
·         In minInclusive and MaxInclusive we can include the extreme values where as in MinExclusive and MaxExclusive, we can not include extreme values.
Restrictions on List of values:
<xs: element name=”xxx”>
  <xs: simpleType>
     <xs:restriction base=”yyy”>
         <xs:enumeration value=”value1”/>
      <xs: enumeration value=”value2”/>
      <xs: enumeration value=”value3”/>
    </xs: restriction>
  </xs: simpleType>
</xs: element>

Patterns:

Syntax:
 <xs: element name=”xxx”>
  <xs: simpleType>
    <xs:restriction base=”yyy”>
     <xs: pattern value=”[a..z],[a-z]”/>
   </xs: restriction>
</xs:simpleType>
</xs:element>
·        
The above pattern indicating the length of the data to be three characters and the characters must be only lower case alphabets.
Patterns2:
<xs: pattern value=”[a-zA-Z][a-Za-z]”/>
·         The above pattern indicates that the data must contain two characters and the characters can be either lower case alphabets or uppercase alphabets.
Patterns3:
<xs: pattern value=”[aeiou]”/>
·         The above pattern indicates the data can contain only one character among a,e,I,o,u
Pattern4:
<xs: pattern value=”[0-9][0-9]”/>
·         The above pattern indicates that data should contain exactly two digits.
Pattern5:
<xs:pattern value=”([a-z])*”/>
·         The above pattern indicates that data can contain 0 or more characters and the characters should be only lower case alphabets.
Pattern6:
<xs: pattern value=”([a-z][A-Z])+”/>
·         The above pattern indicates that data can contain even number of characters and it should contain min/max two characters out of which the first one is lower case alphabet the second one is upper case alphabet
Pattern7:
 <xs: pattern value=”[0-9]{10}”/>

·         The above pattern indicates that the data must contain exactly ten(10) digits.

Occurrence Indicators



It indicates the no. of times the XML element can be available in the XML document.
1.       Minoccurs:
It indicates the minimum no. of times a XML element must occur in the XML document.
2.       Maxoccurs:
It indicates the max no of times a XML element can be available in the XML document

 

Order Indicators



These indicators specify the order and they specify whether the child elements are mandatory or not?
1.       Sequence:
This indicator indicates that child elements are mandatory and the order of child elements is fixed.
2.       All:
This indicates that all the child elements are mandatory but the order is not fixed.
3.       Choice:
This indicator specifies that we can use any one of the child element