What is XML?
Q 1. What is XML?
Ans:
XML stands for eXtensible Markup Language – It is a text -based markup language that allows us to store data in a structured format.
Q 2. What is a markup language?
Ans:
A markup language is a language which has a set of rules / tags that define the structure and format of text while presenting text. Some markup languages (especially those used in wordprocessors) only describe appearances, such as bold, italics. So these systems can only be used for display, and are not easily re-usable.
Q 3. What does extensible mean?
Ans:
The word extensible means you can extend XML ‘s specifications to define new markup languages. e.g. ADML, GML, WML, Math ML.
Q 4. Is XML a programming language?
Ans:
XML is not a programming language. It is used to format data or content, usually for storage, transmission, or processing by a program. It says nothing about what you should do with the data like programming languages can.
Q 5. What is XML derived from?
Ans:
XML’ ancestor is SGML (Standard Generalized Generic Markup Language) which is the system for defining new markup languages .SGML was too complex to program in Web Environment. XML kept its basic functionality but removed all the optional features. XML is a lightweight cut-down version of SGML
Q 6. What is the meta language?
Ans:
A system that allows for defining new markup languages is known as meta language.
Q 7. Give example some markup languages?
Ans:
i) HTML
ii) Latex
iii) MathML
Q 8. What is the difference between XML and SGML?
XML | SGML |
---|---|
It does not include complex and optional features of SGML. | It is complex and requires overheads to use it. |
XML allows creation of new tags to describe and present your data. | It is an ISO standard for specifying a set of tags, |
XML allows data validation. | SGML does not allow data validation. |
It describes the data and transfers data between applications. | It allows you to define and create platform-independent files. |
Q 9. What is the difference between HTML and XML?
HTML | XML |
---|---|
HTML tags are predefined. | XML tags are not predefined. |
HTML is case insensitive. | XML is case sensitive. |
HTML is markup language that creates the form and appearance of the Web page. | XML is neither a programming nor a presentation language. |
Q 10. What is the difference between XML and EDI?
EDI | XML |
---|---|
EDI (Electronic Data Interchange) is a collection of standards, formats and file layout. | XML is a standard designed to simplify Web-based transactions between computer applications. |
EDI enables highly secure document exchanges. | XML document typically needs to be encrypted to maintain security level. |
EDI documents are sent via private and relatively expensive Value-Added Networks (VANs). | XML documents are generally sent via the Internet. |
EDI allows companies to exchange electronic documents quickly between their trading partners. | XML allows you to create custom tags to present your document in a structured format |
Q 11. What are the Features of XML?
Ans:
- XML was designed to carry data, not to display data
- XML does not DO anything
- XML is designed to be self-descriptive
- XML is free and extensible
- XML is a platform independent
- XML can Separate Data from HTML
- XML is a W3c Recommendation
Q 12. Give some names of languages derived from XML?
Ans:
- ADML
- GML
- WML
- Math ML
Q 13. What are the rules for XML?
Ans:
W3C has laid down certain rules that need to be followed by all XML applications Listed below are some of these rules:
- XML must be directly usable over the internet
- XML must support a wide variety of applications
- XML must be compatible with SGML
- The number of optional features in XML needs to be kept to the absolute minimum ideally zero
- XML document must be human -legible and clear
- XML design must be formal and concise
Q 14. What is XML document system?
Ans:
An XML document system mainly comprises of the following:
- A style sheet presentation though CSS or XSL
The Style -Sheet Presentation define the style (i.e. how they would appear orRendered
e.g. their font, color alignment etc.) of the elements
- A style sheet presentation though CSS or XSL
- A grammar structure through DT
The grammar structure defines the rule book of the XML document.
- A grammar structure through DT
- Semantics of data through XML file
The XML file (also called XML -document) contains and described the actual data
- Semantics of data through XML file
Q 15. What is the Physical Structure of an XML document?
Ans:
The physical structure contains.
- An Entity as a storage unit.
- A Parsed Entity is processed by XML -software such as xml parser
- An Unparsed Entity contains some related information and is not processed by XML -parser.
Q 16. What is the logical structure of an XML –document?
Ans:
XML -document consists of mainly
- The Prolog
- The Data Instance
Q 17. What is Prolog?
Ans:
Prolog is an optional structure element, but for well formed document, it must be included
Q 18. What are the components of Prolog?
Ans:
The prolong has five components
- XML Declaration
- Processing instructions
- Document type Declaration
- Comments
- White Space
Q 19. What is XML Declaration?
Ans:
- XML Declaration: XML Declaration contains details to prepare an XML processor to parse the XML document
It provides below information.
- XML version used
- character encoding used
- Whether it has external Document Type definition or not.
- E.g. A complete Xml declaration will look like:
<?xml version = “1.0” encoding = “UTF-8” standalone = “no”? >
- The XML version is by default 1.0.
- Encoding gives the character encoding used in the document. Unicode UTF-8 is the default value however most XML processors support UTF-16, Windows-1252, and ISO-8859 too.
- Standalone has default value of no. It is set to yes if you have an external DTF file.
Q 20. What are the rules for XML declaration?
Ans:
If you include XML declaration it needs to follow below rules.
- It has to be first line in the document and mandatorily need to have version number.
- All attributes need to be in the given order.
- Attribute Names have to be in lower case
- Values need to be in single or double quotes.
- Note that declaration has no closing tag i.e. </?xml>
Q 21. What is Processing instructions or PI?
Ans:
- Processing instruction or PI are the instructions that pass information to applications. A processing instruction has the following syntax.
<? Appname attributes>
- Its typically used to link style sheets as shown below.
e.g. <? Xml -stylesheet type = “text /css” href = “main.css”?>
- It can occur anywhere in the document
- Programs which do not recognize it can ignore it.
Q 22. What is Document type Declaration?
Ans:
The document type declaration consists of Markup codes (i.e. tag etc.) that indicate the grammar rules for the particular class of the document. The grammar rules are called Document Type Definition (DTD).
It gives information on the
- Name of the root element
- Specifies the DTD which the document uses. It can be internal meaning embedded in DOCTYPE declaration or external.
- Here’s a syntax and example.
<!DOCTYPE myinfo>
<!DOCTYPE myinfo SYSTEM=”myinfo.dtd”>
Q 23. What are Comments in prolog?
Ans:
The comments are not processed by XML -parsers .The comments are inserted for purpose like:
- To add notes about document structure
- To break a document into sections
E.g. <!— Almost finishing Prolog –>
Q 24. What is White Space is Prolog?
Ans:
White space refers to spaces, tabs, carriage-return and blank lines. You can insert whitespaces to enhance readability of your document. XML parsers ignore additional white spaces
Q 25. What is the Root/Document Element?
Ans:
XML document must contain one element that is parent of all other elements this parent element is known as root element or document element.
The parent element of all other element in data instance is known as root element or document element.
Q 26. What are parts of an Element?
Ans:
The content of an element is nested between start tag and end tag.
- Start tag
The start tag is the name of the element written inside angle brackets (<>)
It starts the definition of an element. E.g. <book>
- End tags
The end tag has the same name as that of its start tag but along with a preceding slash before the name. E.g. </book>
An empty element tag (or simply empty tag) is a tag without end tag.
It is written as the tag name with a following slash e.g., <book/>
Q 27. What are the Child Elements?
Ans:
An element can have other elements nested inside it.
The elements nested inside other element are called as child element.
Q 28. What are the Naming rules in XML?
Ans:
Naming rules for tags and attributes in XML are.
- XML is case sensitive
- Spaces are not allowed in names.
- Names cannot start with string “xml”
- Names start with letter or underscore.
- Rest can consist of letters, digits, underscore, dot(.)or a hyphen (-)
By convention – HTML element in XML are written in uppercase, and XML elements are written in lowercase
Q 29. What are Attributes?
Ans:
Attribute is the property setting of the element. Attributes are defined through name -value pairs. All attribute values must be enclosed in quotation marks; single or double.
Q 30. What are the Predefined Entities?
Ans:
To enter special character in text you can us predefined entities as per the table
Character | Pre-Defined Entity |
---|---|
& | & |
< | < |
> | > |
“ | quot; |
‘ | apos; |
Q 31. What is well-formed document?
Ans:
A document that obeys the syntax of XML is well -formed document. The XML document that obey XML grammar rules is called well-formed document.
- XML, document must contain at least one element.
- XML document must contain a unique opening and closed tag that contains the whole document, forming what is called a root element.
- All tags must be closed properly, i.e. there must be a proper opening and a closing tag In XML, empty tags must end with a following slash e.g. <book/>
- All other tags must be nested properly i.e. the start and end tags of child element cannot overlap
- Tags in XML are case sensitive.
- Attribute values must always be in quotes
Q 32. What is the valid document?
Ans:
A valid Xml document is the one that is well -formed as well as confirms to the specification of DTD.
- Well -formed document
- Follows its DTD
Validation can be done only if the Xml document has valid DTD.
Q 33. What is DTD?
Ans:
Document Type Definition, DTD are set of rules that define what tags appear in an XML document.
Q 34. What is the CSS?
Ans:
Cascading Style Sheets (CSS) are a collection of formatting rules that control the appearance of content in a web page.
Q 35. What is a valid XML document?
Ans:
A valid XML document is the one that is well formed as well as confirms to the DTD or schema of the document
Q 36. GIVE EXAMPLES OF SOFTWARE THAT VALIDATE XML DOCUMENT?
Ans:
- Xml validator
- Xml parser
Q 37. What is XML Validator?
Ans :
XML validator are the software packages that check the XML document as per the specified DTD and gives us feedback about the document.
Q 38. Give examples of XML Validators?
Ans:
- W3C XML validator
- TIDY
- com’s
- University of Edinburgh’s
- Born university’s
Q 39. What are XML Parsers?
Ans:
XML parsers are the software packages that checks the syntax and structure used in XML file.
Q 40. Give some examples of XML parsers?
Ans:
- SAX (Simple Apply for XML )
- expat
- TclExpal
- LTXML
- XML4j (XML for java )
Microsoft’s validating XML processor