Skip to content

33. XML InfoSet, DTDs/XSDs, System.Xml, XML Schema

March 29, 2011

97. Why is the XML InfoSet specification different from the Xml DOM? What does the InfoSet attempt to solve?
XML Information Set(InfoSet) is a W3C specification describing an abstract data model of an XML document in terms of a set of data items. The definitions in the XML Information Set specification are meant to be used in other specifications that need to refer to the information in a well-formed XML document. An XML document has an information set if it is well-formed and satisfies the namespace constraints. There is no requirement for an XML document to be valid in order to have an information set. DOM, XPath data model and SXML are all instances of the XML Information Set. InfoSet is the generalized representation of an XML Document and specifies significant information of the XML document. The DOM is an instance of the InfoSet and represents an XML document in memory to read, edit and manipulate the XML document.

98. Contrast DTDs versus XSDs. What are their similarities and differences? Which is preferred and why?
DTD defines the document structure of an XML Document, with a list of legal elements and attributes. DTD was a precursor to XSD and have similar functions, although different capabilities. DTD’s use a terse formal syntax that declares precisely which elements and references may appear where in the document of the particular type, and what the elements’ contents and attributes are. XML Schema(XSD) also describe the structure of an XML document. XSD can be used to express a set of rules to which the XML Document must conform in order to be considered valid, however XSD adds a design element of the production of a collection of information adhering to specific data types. This is the post validation InfoSet, especially useful in the development of XML document processing software. XSD’s are preferred since an XML Schema allows the contents of an element or attribute to be validated against a data type. As an example, an attribute might be constrained to hold only valid data or a decimal number.

99. Does System.Xml support DTDs? How?
System.Xml namespace provides standards based support for processing XML. The supported standard is XML 1.0 including DTD support. The XMLReader class can enforce validation using a DTD or XSD schema. To perform validation against a DTD, the XMLReader uses the DTD defined in the DOCTYPE declaration of an XML document. The DOCTYPE declaration can either point to an inline DTD or can be referenced to an external DTD file. ToDo: Set the XmlReaderSettings.DtdProcessing property to DtdProcessing.Parse. Set the XmlReaderSettings.ValidationType property to ValidationType.DTD.

100. Can any XML Schema be represented as an object graph? Vice versa?
Yes.

Happy Programming! =)
Source: mainly MSDN, wikipedia.

Advertisements

From → OOP

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

%d bloggers like this: