Results 1 to 5 of 5

Thread: XML Restrictions or Facets

  1. #1
    Join Date
    Nov 2009
    Posts
    67

    XML Restrictions or Facets

    I have recently started studying XML Schema Definition (XSD) as per my professional commitments. We are going to have a project which also requires to have knowledge of XSD. I have earlier studied C, C++, Java and even HTML, but I am new to XSD concept. I need help regarding XSD Restrictions or XSD Facets. Also I am not very much clear about the concept of XSD Simple Element and XSD Attribute. Please provide the explanation for the same.

  2. #2
    Join Date
    Feb 2008
    Posts
    1,852

    XML Facets

    Restrictions in normal programming terms is defined as a value or rules to control the input or required data. In XSD, we call these restrictions as facets which are applied on XML elements. In XSD, Series of Values can be restricted and even Set of Values and Values. These XSD Facets allows the program to accept only the required data for storage or manipulation.

  3. #3
    Join Date
    May 2008
    Posts
    2,297

    XSD Facets for data validation

    For programmer it may be required that a value is to be entered to a required length. Thus to verify the length of the entered value in XML Schema Definition Facets are imposed on Length. The XSD code below provides an example to accept the password upto required length.
    Code:
    <xs:element name="Pwd">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:length value="7"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:element>
    The above code will accept password if it is of length 7 characters. Thus facets can be useful for data validation.

  4. #4
    Join Date
    May 2008
    Posts
    2,012

    Simple element in XSD

    The XML file elements are defined by the XML Schemas. Thus, to put in simple words the element in XML which has nothing other than text is termed as XSD Simple element. Though there is a restriction of accepting only text it can be a user defined i.e. custom type or can include the text that is a part of XML Schema definition.

  5. #5
    Join Date
    Oct 2005
    Posts
    2,393

    Re: XML Restrictions or Facets

    Another way to refer to the XML Schema language is by the name of XML Schema Definition (XSD). There are Simple type and Complex type elements in XML Schema Definition. It is only legal for a complex type to have attributes. Also the declaration of attribute is also of Simple type. To define an attribute use the following syntax:
    Code:
    <xs:attribute name="xyz" type="zyx"/>
    zyx = attribute data type.
    xyz = attribute name

Similar Threads

  1. Remove Volts restrictions of GTX 680
    By Madri in forum Overclocking & Computer Modification
    Replies: 4
    Last Post: 03-07-2012, 03:47 PM
  2. More limits and restrictions in FarmVille
    By Indulal in forum Video Games
    Replies: 5
    Last Post: 27-02-2011, 07:47 AM
  3. How to Enable application restrictions
    By Doroteo in forum Windows Software
    Replies: 5
    Last Post: 03-02-2010, 02:40 PM
  4. Creating User Restrictions in Win XP
    By monsitj in forum Operating Systems
    Replies: 3
    Last Post: 06-08-2008, 02:52 PM
  5. Time Restrictions
    By Klums in forum Windows Security
    Replies: 3
    Last Post: 10-12-2007, 05:45 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,991,286.38553 seconds with 17 queries