Скачать презентацию Class Overview DTD Project discussion Visual Скачать презентацию Class Overview DTD Project discussion Visual

78a52d4353d306805ab8779d11246cc8.ppt

  • Количество слайдов: 13

Class Overview • • DTD Project discussion Visual Studio. NET Assignment 1 Thayer School Class Overview • • DTD Project discussion Visual Studio. NET Assignment 1 Thayer School of Engineering Dartmouth

DTD’s. . This the “syntax” of an XML document. The structure (elements, etc) of DTD’s. . This the “syntax” of an XML document. The structure (elements, etc) of an XML document are specified by a “schema”. If an XML document adheres to a prespecified schema, it is valid. . ie the syntax is compliant with the schema. Schemas are specified by DTD’s or XML Schema. We’ll look at both DTD’s and XML Schema next. Thayer School of Engineering Dartmouth

The role of XML Request Database, web service etc CGI, PHP, VB, etc XML The role of XML Request Database, web service etc CGI, PHP, VB, etc XML document Parse, validate Application DTD or XML Schema Data is formatted into an XML doc Formatting is done in compliance with XML schema or DTD Thayer School of Engineering Dartmouth XML doc is parsed and possibly validated by parser Application uses content (for presentation CSS) or other kind of application (web service)

Different types of DTD’s Internal DTD - inside. xml file <? xml version=“ 1. Different types of DTD’s Internal DTD - inside. xml file External DTD - file with. dtd extension “SYSTEM” (private) vs “PUBLIC” Local extensions, rules can be added to external reference and override the external DTD. Thayer School of Engineering Dartmouth

Using a DTD from within an. xml <? xml version=“ 1. 0” standalone=“no”? > Using a DTD from within an. xml . . . Naming DTD’s using Formal Public Identifiers (FPI’s). . . Next class. . structure of the DTD and XML Schema. Thayer School of Engineering Dartmouth

Defining elements <!ELEMENT people(name, company)> Elements name and company must be defined elsewhere, before, Defining elements Elements name and company must be defined elsewhere, before, after or externally. means name occurs at least once, company zero or more times. + means at least once, ? means zero or one, * means zero or more so (name, name+) means at least three time, etc. Thayer School of Engineering Dartmouth

Kinds of Elements • <!ELEMENT weather(temp, wind, precip)> - as before • <!ELEMENT photo Kinds of Elements • - as before • - attributes only • - any elements allowed! • #PCDATA indicates text (leaf element) Thayer School of Engineering Dartmouth

Defining Attributes <!ELEMENT weather(temp, wind, precip)> <weather units=“US”> <temp. . </weather> <!ATTLIST weather units Defining Attributes weather - element for which attribute declared units - name of attribute for weather xxx - either PCDATA or (US|INT) yyy - either default or #FIXED “default” or #REQUIRED or #IMPLIED Thayer School of Engineering Dartmouth

Defining Attributes default - value if not specified #FIXED “default” - value it must Defining Attributes default - value if not specified #FIXED “default” - value it must be if specified #REQUIRED - not optional #IMPLIED - optional, no default value Precede by “ID” if value is required to be unique for all attributes in the XML document, see also IDREF Thayer School of Engineering Dartmouth

Defining Entities (Macros) <!ENTITY MS “Microsoft Corporation”> In an XML document. . . <company>&MS; Defining Entities (Macros) In an XML document. . . &MS; expands to Microsoft Corporation when parsed. Thayer School of Engineering Dartmouth

Defining External Entities File ms. ent contains Microsoft Corporation, Redmond, WA In DTD file, Defining External Entities File ms. ent contains Microsoft Corporation, Redmond, WA In DTD file, abc. dtd put In the XML document. . . . . &MS; expands to Microsoft Corporation, Redmond, WA Thayer School of Engineering Dartmouth

Defining External Entities File entity. dtd contains an element declaration. In another DTD file, Defining External Entities File entity. dtd contains an element declaration. In another DTD file, abc. dtd put In the XML document. . . . . %MS; . . Non-parsed entities. . read about them on your own. . . XML Schema is another way to declare XML structure. . do it on your own. Brown XML validator http: //www. stg. brown. edu/pub/xmlvalid/ Thayer School of Engineering Dartmouth

Project Discussion Class project • description/goals • resources • schedule/milestones • assignments • deliverables Project Discussion Class project • description/goals • resources • schedule/milestones • assignments • deliverables Thayer School of Engineering Dartmouth