Explain DTD

A document type definition (DTD) describes the permissible tags of an XML document.
The DTD serves as a data template. It defines entities, elements, attributes, and notations, as well as the relationships between these.
For example, the DTD can state that a memo element consists of To, From, Subject, and Message elements.
You need to use a DTD [...]

Is an XML schema an alternative to DTD

Schemas are becoming more popular and DTDs less so. A schema is an XML-based syntax for describing how the XML document is marked up or how it looks – very similar to a DTD, but a DTD has a lot of drawbacks.A DTD doesn’t use anything like XML syntax to describe the definition. You can’t [...]

Explain XML Namespaces

An XML namespace is a collection of element names or attribute names to be defined within an XML document.Let’s say you have an invoice XML document and an order XML document and you want to put them together. You usually have certain names that overlap each other – like the date. You might have an [...]

What are the advantages of XML

XML is free form which means that you can configure it any way you want. It’s also very easy to read – you don’t have to read cryptic code to figure it out.It was designed specifically for internet protocols, and this makes it simple to transmit an XML document across, for example, a HTTP protocol.Strong [...]

Differences between DTD and Schema

 
XML Schema
DTD

Markup validation
Any global element can be root. No ambiguous content support.
Can specify only the root element in the instance document. No ambiguous content support.

Namespace support
Yes. Declarations only where multiple namespaces are used.
No.

Code reuse
Can reuse definitions using named types.
Poorly supported. Can use parameter entities.

Datatype [...]

What are the disadvantages of DTD

They are not written in XML syntax, which means you have to learn a new syntax in order to write them
there is no support for namespaces
there are no constraints imposed on the kind of character data allowed, so datatyping is not possible
there is minimal support for code modularity and none for inheritance
large DTDs are hard [...]

85. Explain about XML attributes

Attributes are simple name/value pairs associated with an element.
They are attached to the start-tag, as shown below, but not to the end-tag:
<name nickname=”sharat”><first>sharat</first><middle></middle><last>lastname</last></name>
Attributes must have values–even if that value is just an empty string (like “”)–and those values must be in quotes.
Attributes Can Provide Meta Data that May Not be Relevant to Most Applications Dealing [...]

84. What do you mean by well-formed XML

XML documents must adhere to following rules to be well-formed.

Every start-tag must have a matching end-tag, or be a self-closing tag
Tags can’t overlap
XML documents can have only one root element
Element names must obey XML naming conventions
XML is case-sensitive
XML will keep whitespace in your text

83. What are the differences between SAX and DOM parser.

SAX
DOM

Both SAX and DOM are used to parse the XML document. Both has advantages and disadvantages and can be used in our programming depending on the situation.

Parses node by node
Stores the entire XML document into memory before processing

Doesn’t store the XML in memory
Occupies more memory

We cant insert or delete a node
We can insert or delete [...]

82. Describe the differences between XML and HTML

XML
HTML

User definable tags

Defined set of tags designed for web display

Content driven

Format driven

End tags required for well formed documents

End tags not required

Quotes required around attributes values

Quotes not required

Slash required in empty tags

Slash not required