Google News
logo
XML Interview Questions
XML Schema Definition(XSD) is another name for XML Schema . It describes and validates the structure and content of XML data. The elements, attributes, and data types are defined by the XML schema. Namespaces are supported by Schema elements. It is analogous to a database schema, which describes the data in a database.
Naming rules are :
 
* Element names must start with a letter or underscore.
* Element names are case sensitive.
* Element names cannot start with the letters XML.
* Element names can contain letters, digits, hyphens, underscore, and periods.
* Element names cannot contain spaces.
XSNL stands for XML Search Neutral Language. This language acts between the meta-search interface and the targeted system.
There are two types of data types in XML schema.
 
* simpleType
* complexType

simpleType : The simpleType allows you to have text-based elements. It contains less attributes, child elements, and cannot be left empty.
 
complexType : The complexType allows you to hold multiple attributes and elements. It can contain additional sub elements and can be left empty.
<xs:element name="employee"> : It defines the element name employee.
 
<xs:complexType> : It defines that the element 'employee' is complex type.
 
<xs:sequence> : It defines that the complex type is a sequence of elements.
 
<xs:element name="firstname" type="xs:string"/> : It defines that the element 'firstname' is of string/text type.
 
<xs:element name="lastname" type="xs:string"/> : It defines that the element 'lastname' is of string/text type.
 
<xs:element name="email" type="xs:string"/> : It defines that the element 'email' is of string/text type.
XSL stands for Extensible Stylesheet Language. It is a language for expressing stylesheets. These stylesheets are like CSS which describes how to display an XML document of a given type.
XPath is a technology used in XML. It is used to retrieve elements from XML documents. XPath expressions can be used to locate and retrieve elements, attributes and values from XML files because XML documents are structured. It is similar to SQL.
 
As SQL is used to retrieve data from database, XPath is used to retrieve data from XML.
An XML element is everything from (including) the element's start tag to (including) the element's end tag.
<price>15.30</price>
An element can contain :
 
* text
* attributes
* other elements
* or a mix of the above
<bookstore>
  <book category="children">
    <title>Shiva</title>
    <author>Ram</author>
    <year>2019</year>
    <price>15.30</price>
  </book>
  <book category="web">
    <title>Learning XML</title>
    <author>Narayan</author>
    <year>2021</year>
    <price>19.90</price>
  </book>
</bookstore>
In the example above :
 
<title>, <author>, <year>, and <price> have text content because they contain text (like 15.30).
 
<bookstore> and <book>have element contents, because they contain elements.
 
<book> has an attribute (category="children").
An element with no content is said to be empty.
 
In XML, you can indicate an empty element like this :
<element></element>
You can also use a so called self-closing tag :
<element />
The two forms produce identical results in XML software (Readers, Parsers, Browsers).
 
Empty elements can have attributes.
CDATA is unparsed character data that cannot be parsed by the XML parser. Character < and > are illegal in XML elements. CDATA section starts with <![CDATA[“ and end with “]]>.