1 / 13

Basic XML Concepts

Basic XML Concepts. Web Programming Maymester 2004. XML fundamental concepts. XML is not a language, but a structure for defining application-specific mini-languages Tags, elements and attributes Tag names can be ANYTHING (depends on application. Example XML document. XML/HTML entities.

ranee
Télécharger la présentation

Basic XML Concepts

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Basic XML Concepts Web Programming Maymester 2004

  2. XML fundamental concepts • XML is not a language, but a structure for defining application-specific mini-languages • Tags, elements and attributes • Tag names can be ANYTHING (depends on application

  3. Example XML document

  4. XML/HTML entities • Some symbols cannot appear in document content because they confuse parsing • Entities represent these symbols

  5. Well-Formed XML document • Every tag has a matching closing tag • Tags are properly nested • You can have an empty element, which is its own matching close tag • <danger voltage=“480” /> • All attribute values appear in quotes

  6. Valid XML document • A valid document must be well-formed • In addition, the document conforms to a language definition • The language definition specifies possible tags, their contents, and their attributes • Two types of language definitions: • Document Type Definition (DTD) • XML Schema

  7. Document Type Definition • Example: a letter contains a source and destination address, a salutation, one or more paragraphs, and a closing

  8. DTD Attribute Definitions • REQUIRED: must always appear • IMPLIED: optional • FIXED: required, and always has same value

  9. DTD Data Types & Quantifiers • #PCDATA =“parsed character data”, can contain no XML markup chars • Use entities to replace markup chars • “X+” means one or more instances of X • “X*” means zero or more instances of X • “X?” means zero or one instances of X

  10. Where to put DTDs • Can be embedded in the DOCTYPE declaration, as in previous example • SYSTEM DTD refers to a file on the same machine: • PUBLIC DTD gives a URL to the DTD:

  11. XML Schema • Document definition file is also an XML document, unlike DTD • Gives much tighter control over contents of XML document • See http://www.w3.org/TR/2000/CR-xmlschema-0-20001024/ for details

  12. XHTML • HTML that conforms to XML format • Stricter grammar rules than HTML 4.01 Strict • All tag names in lower case • V

  13. Acknowledgements Examples taken from Sun J2EE tutorial, http://java.sun.com/webservices/docs/1.3/tutorial/doc/IntroXML.html

More Related