Presentation is loading. Please wait.

Presentation is loading. Please wait.

Week-9 (Lecture-1) XML DTD (Data Type Document): An XML document with correct syntax is called "Well Formed". An XML document validated against a DTD is.

Similar presentations


Presentation on theme: "Week-9 (Lecture-1) XML DTD (Data Type Document): An XML document with correct syntax is called "Well Formed". An XML document validated against a DTD is."— Presentation transcript:

1 Week-9 (Lecture-1) XML DTD (Data Type Document): An XML document with correct syntax is called "Well Formed". An XML document validated against a DTD is both "Well Formed" and "Valid". Valid XML Documents: A "Valid" XML document is a "Well Formed" XML document, which also conforms to the rules of a DTD. The DOCTYPE declaration, in the example above, is a reference to an external DTD file. The content of the file is shown in the paragraph below.

2 Week-9 (Lecture-1) XML DTD purpose: The purpose of a DTD is to define the structure of an XML document. It defines the structure with a list of legal elements (Note.dtd) file Having the structural information of xml file

3 Week-9 (Lecture-1) When to Use a DTD/Schema? With a DTD, independent groups of people can agree to use a standard DTD for interchanging data. With a DTD, you can verify that the data you receive from the outside world is valid. You can also use a DTD to verify your own data. When NOT to Use a DTD/Schema? XML does not require a DTD/Schema. When you are experimenting with XML, or when you are working with small XML files, creating DTDs may be a waste of time. If you develop applications, wait until the specification is stable before you add a document definition. Otherwise, your software might stop working because of validation errors.

4 Week-9 (Lecture-1) The following diagram represents that a DTD is used to structure the XML document: (Diagram DTD)

5 Week-9 (Lecture-2) XML DOM (Document Object Model): The Document Object Model (DOM) is a W3C standard. It defines a standard for accessing documents like HTML and XML. it is an application programming interface (API) for HTML and XML It defines the logical structure of documents (DOM Diagram)

6 Week-9 (Lecture-2) AdvantagesDisadvantages 1- XML DOM is language and platform independent 1- Consumes more memory (structure is very large) 2- Information in XML DOM is organized in a hierarchy 2- Program written once remains in memory all the time 3- Allows developer to navigate around the hierarchy 3- Speed compared to SAX is slower (use of large memory) 4- It is dynamic in nature (add, edit, delete)

7 Week-9 (Lecture-2) XML Parser: A parser is a software application it is designed to analyze a document. Loading and parsing XML: While loading an XML document, the XML content can come in two forms: 1.Directly as XML file 2.As XML string

8 Week-9 (Lecture-2) Some DOM Attributes: AttributeTypeDescription nameDOMStringIt returns the name of the DTD which is written immediately next to the keyword !DOCTYPE. entitiesNamedNodeMapIt returns a NamedNodeMap object containing the general entities, both external and internal, declared in the DTD. notationsNamedNodeMapIt returns a NamedNodeMap containing the notations declared in the DTD. internalSubsetDOMStringIt returns an internal subset as a string, or null if there is none.This has been removed


Download ppt "Week-9 (Lecture-1) XML DTD (Data Type Document): An XML document with correct syntax is called "Well Formed". An XML document validated against a DTD is."

Similar presentations


Ads by Google