- Syntax rules for well-formed XML e.g. must have a single root element, closing tags required, proper tag nesting, case-sensitive, values in single or double quotes, all-in-one opening & closing tag allowed for empty elements with attributes, processing instructions and comments do not need closing tags, entity references must be declared (except for those built-in)
- CDATA can be used to display tags as text
<![CDATA[<person>Gareth</person>]]>
DTD vs. XML Schema
- DTD is non-XML like syntax, all declarations are global, unable to control kind of information elements can contain
- XML Schema was designed to overcome these weaknesses
DTD (*.dtd or internal to *.xml document)
<!DOCTYPE people [
<!ELEMENT person (name,age,weight/?,address)>
<!ATTLIST name language(EnglishLatin)>
]>
XML Schema (*.xsd)
- Two types of content:
- Simple Content - elements that contain only text of built-in (type="xsd:string") or custom type
- Complex Content - elements that contain other elements or attributes
- Anotations can be used to describe parts of the schema
- Built-in types includes string, decimal, boolean, date, time, uri-reference, ISO language etc.
- Custom types allow Perl regex, inclusive/exclusive ranges, length, precision, lists, fixed and default values, choices, sequences etc.
XSLT (*.xslt)
- Used to analyse and transform XML documents into another format
- An XSLT processor converts XML into a node tree and uses the XSLT style sheet instructions to transform it
- Makes use of XPath to refer to individual parts of an XML document
XPath 1.0/2.0
- Used by XSLT, XSL-FO, XQuery, XInclude etc to refer to all or part of the text, data and values in XML documents
- Allows XML files to include all or part of an external file
- Equivalent of SQL to access, manipulate and return XML
- Defines syntax and processing rules for creating digital signatures in XML
- Defines syntax and processing rules for encrypting XML
- Can be used to address components of XML-based internet media
XSL-FO (XSL Formatting Objects)
- An XML-based page layout language, an XSL-FO processor can convert an XSL-FO document into another format e.g. a PDF
XLink (XML Linking Language)
- Used for creating HTML-like hyperlinks in XML
No comments:
Post a Comment