x

XML Fundamentals

PREV     NEXT

XML Fundamentals:


  1. XML markup describes and provides structure to the content of an XML document or data packet.
  2. Unlike HTML, XML is case-sensitive including element-tags and attribute values.
  3. XML uses most of the characters defined in the 16-bit unicode character set.
  4. 2 unicode formats are the basis of XML characters – UTF-8 and UTF-16.
  5. 3 control characters are:
    XML Control characters
    Horizontal Tab(HT) 09
    Line Feed (LF) 0A
    Carriage-Return (CR) 0D
  6. 5 special markup characters are: <   >   &   ”   ‘ . These characters have alternate representations in the form of entity references.
  7. When representing a legal XML name, the first character must be either a unicode character, an underscore or a colon. The other characters may be one of these – unicode character, unicode number, underscore, colon, hyphen or a period.
  8. Colon char should not be used except as a namespace delimiter
  9. Colon char should not be used except as a namespace delimiter
  10. Elements are the basic building blocks of XML markup. Tags consist of element type names.
  11. Everything between the start-tag and the end-tag of an element is contained within that element.
  12. Examples
    Examples of legal XML names
    < ElementName> Not Allowed
    Allowed
    < /Name> Not Allowed
    Not Allowed
    Allowed
    Not Allowed
    Allowed
    Not Allowed
  13. Empty element tags may have associated attributes
  14. XML documents have three parts -prolog (optional), body (required) and epilog(optional)
  15. Document root/ Document entity is the root element of the XML document (which is not visible), this has a subtree(body), the root element of that subtree is called Document element/Root element.
  16. Prolog may contain – XML declaration, comments, PIs, DOCTYPE declaration
  17. Epilog may contain – PIs or comments.
  18. XML data is in the form of a simple hierarchical tree.
  19. All elements must be properly nested, no overlapping of tags is allowed.
  20. String literals are used for the values of attributes, internal entities and external identifiers.
  21. All string literals are enclosed by apos (‘) or quot (“)
  22. Attributes are comprised of name-value pairs.
  23. Permissible values for attributes are — Text characters, Entity references, character references. Forbidden characters in attribute values: < and >. Use the entity references instead. Only one instance of attribute name is allowed within a given tag.
  24. All whitespace characters in the content are preserved and whitespace within element tags and attribute values may be removed.
  25. 3 combinations of chars for end-of-line are: CR-LF, CR only, LF only. All these strings are converted to a single LF character.
  26. Except for the 5 built-in entity references, all entities must be defined prior to their use.
  27. Comments in XML must follow these rules –
    1. Cannot have double hyphen within the string
    2. Cannot be nested
    3. Cannot be put in the start or end tag
    4. Extra hyphen at the end is illegal
  28. CDATA Section in XML must follow these rules –
    1. Cannot be empty
    2. Cannot be nested
    3. Text in the CDATA section cannnot contain “]]>”
  29. CDATA Section in XML must follow these rules –
    1. Order of attributes: version, encoding, standalone is fixed.
    2. Version attribute is required, encoding and standalone are optional.
    3. Default value for standalone is “no”
    4. If encoding is other than UTF-8 or UTF-16, it must be specified.
    5. Encoding values are not case-sensitive
  30. Special meaning attributes – xml:lang and xml:space( can have values preserve or default)
  31. XML document has logical and physical structure. Physical – document has storage units: entities. Logical – document is composed of declarations, elements, comments, char references and PIs
  32. Document Type Declaration contains or points to markup declaration that provides a grammar for a class of documents. This grammar is known as Document Type Definition.
  33. DOCTYPE declaration must appear before the first element in the document
  34. No attribute name may appear more than once in the same start tag or empty element tag.
  35. Attribute values cannot contain direct or indirect entity references to external entities.
  36. Markup takes the form of start-tags, end-tags, empty-element-tags, entity references, character references, comments, CDATA sections, DOCTYPE declaration, PIs. All text that is not markup is the character data of the document
  37. Each XML document has one entity -document entity that serves as the starting point for the XML processor.
  38. < and & characters may only appear as such in comments, PIs or CDATA Sections, otherwise these are substituted by respective entity references.
  39. ID, IDREF, IDREFS, ENTITY names – all must be legal XML names NMTOKEN, NMTOKENS, enumerated values should be legal NmTokens

PREV     NEXT



Like it? Please Spread the word!

Post Your Thoughts