Interview Questions for Business Analysts and Systems Analysts


Recent Interview Questions | Search | Subscribe (RSS)

?
INTERVIEW QUESTION:

What is an XML Schema and what is its purpose?

Posted by Chris Adams

Article Rating // 37639 Views // 0 Additional Answers & Comments

Categories: Business Analysis, Systems Analysis, Data Analysis & Modeling

ANSWER

An XML Schema is a document that is itself described using XML and which defines how an XML document must be structured in order to conform to structured required by the a system or service which references the XML Schema.  Specifically it defines:

  • The elements that may appear
  • The attributes that may appear for each element
  • Which elements are child elements
  • The order in which child elements must appear
  • The number of child elements that may appear
  • The data types for each element or attribute
  • Default values and constant value for elements and attributes
  • Minimum and maximum occurrences of an element

The term DTD (Document Type Definition) is often used when discussing the acceptable form of XML documents. However, XML Schemas are successors to XML DTDs and have a number of benefits over DTDs.  Some of these benefits are:

  • Schemas are written in XML
  • Schemas may be extended to future additions
  • Schemas contain a richer set of rules to which data must conform
  • Schemas make it easier to validate correctness of data
  • Schemas support data types

XML schemas are able to enforce specific rules and data conformity such as:

  • Data Types – data conforms to a specific data type (string, date, numeric, boolean, etc)
  • Value restrictions – data conforms to the acceptable values (enumeration, fractionDigits, length, maxExclusive, maxInclusive, maxLength, minExclusive, minInclusive, minLength, pattern, totalDigits, whitespace, etc)
  • Element Indicators – elements conform to specific indicators (Order Indicators, Occurance Indicators, and Group Indicators) which apply rules to how many elements must appear, in what order, or adhering to a specific structure (maxOccurs, minOccurs, all, choice, sequence, etc).


Sample XML Schema

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.somesite.com/2010/XMLSchema"
targetNamespace="http://www.somesite.com"
xmlns="http://www.somesite.com"
elementFormDefault="qualified">

<xs:element name="person">
   <xs:complexType>
      <xs:sequence>
         <xs:element name="firstname" type="xs:string" maxLength=”30” />
         <xs:element name="lastname" type="xs:string" maxLength=”30” />
         <xs:element name="middlename" type="xs:string" maxLength=”30” maxOccurs=”2” />
         <xs:element name="age">
             <xs:simpleType>
                <xs:restriction base="xs:integer">
                   <xs:minInclusive value="0"/>
                   <xs:maxInclusive value="120"/>
                </xs:restriction>
             </xs:simpleType>
         </xs:element>
       </xs:sequence>
   </xs:complexType>
</xs:element>

</xs:schema>

Sample XML which conforms to Schema

<person>
   <firstname>Joseph</firstname>
   <lastname>Smith</lastname>
   <middlename>Brian</middlename>
   <middlename>James</middlename>
   <age>56</age>
</person>

RATE THIS TOPIC

ADDITIONAL ANSWERS / COMMENTS

Only registered users may post comments.

Do your homework prior to the business analysis interview!

Having an idea of the type of questions you might be asked during a business analyst interview will not only give you confidence but it will also help you to formulate your thoughts and to be better prepared to answer the interview questions you might get during the interview for a business analyst position.  Of course, just memorizing a list of business analyst interview questions will not make you a great business analyst but it might just help you get that next job.

 



Upcoming Live Webinars

 




Select ModernAnalyst Content

Register | Login

Copyright 2006-2024 by Modern Analyst Media LLC