InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
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. 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. |
|
| 2. |
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. 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. |
|
| 3. |
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". 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". |
|
| 4. |
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> 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> |
|
| 5. |
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. 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. |
|
| 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. 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. |
|
| 7. |
Why We Use Xml Schemas? |
|
Answer» I have given you some main REASONS those made XML SCHEMAS more powerful than DTD.
I have given you some main reasons those made XML Schemas more powerful than DTD. |
|
| 8. |
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> 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> |
|
| 9. |
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. 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. |
|
| 10. |
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> 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> |
|
| 11. |
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"/> 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"/> |
|