Getting prepared for Xsd job? Do not panic, we will guide you how and what to answer in your interview. If you are preparing for Xsd job interview then go through Wisdomjobs interview questions and answers page. Xsd is Schema for a particular interface can be either request or response. One can create xsd in altova xmlspy tool very easily. xsd is created by drag and drop of the elements. The elements and its attributes are given properties and data types. These schemas are used in building a wsdl. There are fewer openings for this job as this is not much popular and used in all organizations. Please have a look at Xsd interview questions and answers page to win your interview.
Question 1. How You Define Attributes In Xml Schema?
Answer :
You have to note this in XML Schema all attributes are only declare as simple types element not as complex types. Because yes, Simple Elements has no attributes and attributes are only happen with Complex Elements. But key point is that in XML Schema always attribute declare as simple type itself.
Syntax:
<xs: attribute name="abc" type="xyz"/>
Question 2. How You Use Schema Element In Xml Document?
Answer :
We can say that <schema> element is an root element in XML Schema.
Now, I have given you syntax of an XML Schema.
Syntax:
<? xml version="1.0"?>
<xs:schema>
....
....
</xs: schema>
Yes, Schema element can also contain attribute.
Example:
<? xml version="1.0"?>
<xs: schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
target Namespace="http://www.r4r.co.in"
xmlns="http://www.r4r.co.in"
elementFormDefault="qualified">
....
....
</xs: schema>
Question 3. How You Define Complex And Simple Type Of Element?
Answer :
In an XML Schema element are of two types.
Complex Type Element: Complex Type Elements are elements those contain elements.
Simple Type Element: Simple Type Elements are elements those don’t contain any other elements.
I explain you complex and simple type of element with an example:
<? xml version="1.0"?>
<note>
<to>Abhi</to>
<from>Sudhi</from>
<heading>Birthday Wish</heading>
<body>Happy Birthday Dear</body>
</note>
In the above example note element called as complex element because it contains elements(to, from, heading, body).And element to, from, heading and body called as Simple Type Element because it doesn't contain any other element.
Question 4. Give An Example Shows Xml Document Has A Reference To An Xml Schema?
Answer :
This example show you how XML document has a reference to an XML Schema.
Example:
<?xml version="1.0"?>
<note>
xmlns="http://www.r4r.co.in"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.r4r.co.in note.xsd">
<to>Abhi</to>
<from>Sudhi</from>
<heading>Birthday Wish</heading>
<body>Happy Birthday Dear</body>
</note>
Question 5. Why We Use Xml Schemas?
Answer :
I have given you some main reasons those made XML Schemas more powerful than DTD.
Question 6. Explain Why Xml Schemas Are Estensible?
Answer :
Have given you some reasons that say XML Schemas are extensible. We can reuse our XML Schemas with in other XML Schemas. Also we can make our own data types which are derived from standard types. We can refer multiple schemas in a same XML document.
Question 7. What Is Xml Schema?
Answer :
When we don't want to use DTD than we can use XML Schema as an alternative of DTD.Using XML Schema we can describe the structure of XML document. We can also call XML Schema language as XML Schema Definition.
Some main of XML Schema are given below:
XML Schema has W3C Recommendation since 02 May 2001.
Question 8. How You Define Elements Of Xml Document In An Xml Schema?
Answer :
Simple I give you a example of an XML document. Then I told you define elements of this XML document in an XML Schema.
Example shows a XML Document.
<? xml version="1.0"?>
<note>
<to>Abhi</to>
<from>Sudhi</from>
<heading>Birthday Wish</heading>
<body>Happy Birthday Dear</body>
</note>
Now, I will show you how to define these elements(to, from, heading, body)of XML document(saved with "note.xml")in an XML Schema (saved with "note.xsd").
<? xml version="1.0"?>
<xs: schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
target Namespace="http://www.r4r.co.in"
xmlns="http://www.r4r.co.in"
elementFormDefault="qualified">
<xs:element name="note">
<xs:complexType>
<xs:sequence>
<xs: element name="to" type="xs: string"/>
<xs: element name="from" type="xs: string"/>
<xs: element name="heading" type="xs: string"/>
<xs: element name="body" type="xs: string"/>
</xs: sequence>
</xs: complexType>
</xs: element>
</xs: schema>
Question 9. How You Set Default And Fixed Values For Attributes?
Answer :
Mean of default and fixed value in terms of attributes.
Default values are those values that are directly assigned to attribute when this attribute doesn't contain any other defined value.
Example:
<xs: attribute name="lang" type="xs: string" default="EN">
In the above example default value of Lang is "EN".
Fixed values are those values that are directly assigned to attribute but it doesn't contain any other defined value for this attribute.
Example:
<xs: attribute name="lang" type="xs: string" fixed="EN"/>
In the above example fixed value of Lang is "EN".
Question 10. How We Can Say Xml Schemas Are Successors Of Dtds?
Answer :
Because of some reasons we can say that XML Schemas area successors of DTDs.
Some reasons are given below:
But, XML Schemas is much good as DTDs.Because it is much richer and powerful than DTDs.And it also has some features that are made to solve problems comes in future.
Question 11. What Do You Mean By Simple Element?
Answer :
Have already told you XML Schema has defined elements in two types.
Simple Element: In XML simple elements are that element that has contain only text doesn't contain any other elements or attributes.
Text may be of any type that define in XML Schema
Like Boolean, string, date etc.
Syntax:
<xs: element name="abc" type="xyz"/>
Where, ABC is used to define name of element and xyz is used to define data type of element.
XSD Related Tutorials |
|
---|---|
XML Tutorial | XPath Tutorial |
XQuery Tutorial | Document Type Definition (DTD) Tutorial |
WSDL Tutorial |
All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.