Document Type Definition. Either a DTD or Schema is used by a parser to validate the xml doc. The Body of the xml doc starts with the root element. An element consists of a start tag, an end tag & everything in between. A comment. Download presentation Presentation is loading. Please wait.
1
XML Outline 1 XML 2 DTD
2
The xml doc ends with the closing tag of the root element.
3
<. DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc
Similar presentations © 2025 SlidePlayer.com. Inc. Log in
Similar presentations
Presentation on theme: "XML Outline 1 XML 2 DTD."— Presentation transcript:
Lines 1-5 comprise the Prolog. Line 1 is the XML declaration. “version” & “encoding” are attributes. 1 <?xml version="1.0" encoding="ISO "?> 2 3 <!DOCTYPE web-app 4 PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" 5 " "> 6 7 <web-app> 8 <!-- Servlet definitions --> <servlet> <servlet-name>welcome</servlet-name> <servlet-class>WelcomeServlet</servlet-class> </servlet> 14 <!-- Servlet mappings --> <servlet-mapping> <servlet-name>welcome</servlet-name> <url-pattern>/welcome</url-pattern> </servlet-mapping> 20 21 </web-app> Document Type Definition. Either a DTD or Schema is used by a parser to validate the xml doc. The Body of the xml doc starts with the root element. An element consists of a start tag, an end tag & everything in between. A comment. <servlet> is a child of the <web-app> element and a parent to <servlet-name> & <servlet-class>. Well-formed xml docs follow a strict parent-child hierarchy. The xml doc ends with the closing tag of the root element.
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" " DOCTYPE refers to web-app, the root element – this is the definition for this web-app document PUBLIC means the DTD is available on the Internet. Locally-stored DTDs would instead use the SYSTEM keyword, followed by the local path, e.g., “C:\Windows\Desktop\web-app_2_3.dtd” "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN“ is the “Formal Public Identifier” used with PUBLIC DTDs The dash ( - ) indicates the DTD has not been approved by a Standards body, such as ISO. Approved Standard DTDs use a plus sign here ( + ). Sun Microsystems, Inc. is the name of the owner who maintains the DTD. DTD is the document type and Web Application 2.3 is a label that describes the document. EN is the two-letter abbreviation for the language the DTD is written in. Here, it’s English. “ specifies the URL where the parser may find a copy of the DTD. Let’s take a look at this DTD.
Similar presentations
All rights reserved.