| Home News Product Order Forum Feedback Partner Profile | © Neatware 2000 |
| Neatware | Snaml |
|
XML Document |
|
|
Last Update: Wed Apr 12 20:09:03 2000 |
|
Snaml Basic
Introduction Syntax Control Types Modules Status Snaml HTML HTML Structure Link Objects Text Font Snaml CSS CSS Script Snaml CGI CGI Variables Output Form Application Snaml XML XML Document EBNF |
A Snaml program of XML consists of element commands. They may be start, end, or empty element commands. Commands in between the start element command and the end element command are called content of the element command. Element name is the type of the element. A start element command has a single underscore '_' prefix in front of the element name. It may have a name/value pair list as its attribute list. The end element command has a single underscore '_' postfix attached to the element name. It has no argument. The Empty element command has no content. A double underscore '__' prefix is in front of the element name. It may also have an argument of attribute list.
The well-formed constraint of XML requires that (i) an end command must match the start command with the same element name; (ii) attribute name can't appear more than once in the list; (iii) attribute values can't contain entity references; and (iv) the character '<' in an attribute value must be replaced by '<'. You may read the XML specification for element validity.
It refers to a character in the ISO/IEC 10646 character set. For decimal digits its format is 'N' where N is a decimal number. For hexadecimal digits its format is 'M' where M is a hexadecimal number. You may use these digital characters insert Unicode character into an XML document.
It refers to the content of a named entity. It has a prefix ampersand '&' and a postfix semicolon ';'. The entities amp, lt, gt, apos, and quot are predefined entities in XML for '&', '<', '>', ''', and '"'. Entity reference can not include a recursion.
It uses percent sign '%' and semicolon ';' as delimiters. Parameter-entity references may only appear in the DTD.
The empty command __comment specifies its argument as comment. Its XML corresponds are <!-- ... -->. The argument can't contain the double hyphen.
The empty command __pi specifies the processing instructions. It allows document contain instructions for applications. Its syntax is '__pi "piTarget piData" where 'piTarget' identifies an application to which it directs the instruction. The target names 'XML', 'xml', and so on are reserved for future standardization.
The empty command __cdata will ignore the markup text in the argument. Therefore, there is no needs for '<' to '<'. CDATA sections can't be nested. The __cdata command completes the function of <![CDATA[ ... ]]> in the XML.
Through Document Type Declarations (DTD), XML can specify constraints on the logical structure of the markup. DTD must appear before the first element in a document.
In the following example, the first Processing Instruction __pi declares the xml standard with version 1.0. The standalone value 'no' indicates an external markup declaration. It is also the default value. The value 'yes' indicates no markup external declarations to the document entity.
In the __doctype command 'greeting' specifies the document name. The system identifier 'hello.dtd' gives a URL of a DTD declaration for the document.
A typical header for XML document is
__element empty command consists of an element name and a content specification. Element name specifies the new element. The content specification maybe 'EMPTY', 'ANY', 'children', and 'mixed'. It specifies the possible combination of elements in a content: (i) 'EMPTY' specifies that the new element command is an empty command without content and end element command; (ii) 'ANY' allows any content; (iii) 'children' specifies the regular expression of child elements in its content; (iv) 'mixed' means that the content maybe a character data with '#PCDATA' and children.
In a regular expression of child, (i) a vertical bar '|' is or; (ii) an asterisk '*' may occur zero or more times; (iii) a plus '+' must occur more than once; (iv) commas ',' specifies that elements must occur in succession; (v) question mark (?) after an element states the element may occur exactly once or nothing; (vi) an element name without special symbol must occur exactly once
__attrlist empty command specifies the attribute list of an element, attribute type constraints, and attribute default values
where 'elemname' is the related element name; 'attrname' is the attribute name; and 'attrtype' is the attribute type. 'attrtype' maybe a string, a token, or an enumeration: (i) the string type is declared as CDATA. It may be any literal string; (ii) the token type has varing lexical and semantic constraints. 'ID' value must uniquely identify an element. An element can have only one ID. Its default declaration must be '#IMPLIED' or '#REQUIRED'; (iii) 'IDREF' must match the value of an ID attribute; (iv) 'ENTITY' and 'ENTITIES' value(s) must match the name(s). (v) 'NMTOKEN' and 'NMTOKENS' must match Nmtoken(s). Enumeration type declares a list of values that may be 'NOTATION' or 'Nmtoken'.
The default declaration may have the value '#REQUIRED' in which an attribute must be provided; '#IMPLIED' means no default value; '#FIXED AttrValue' means the default value is AttrValue; The symbol '#FIXED' states that the attribute must always have the default value. It maybe omitted and leave AttrValue as default value. When you declare a default value of an attribute and use an element omitted this attribute, XML will suppose this attribute has the default value. Follows are attribute list example,
It associates a name with other contents. An entity has the form '&entityname;'. Internal entities link a name to a string. XML predefines five internal entities: lt, gt, amp, apos, and quot. External entities link a name to the content of a file. The text file will be parsed as another document and the binary file is not parsed. Parameter entities are declared in the document type declaration (DTD). It has '%' prefix. The parameter-entity references in the document type declaration are replaced by the text.
|
|
|
|
Last Update: Wed Apr 12 20:09:03 2000 |
|
XML Document |
| Neatware | Snaml |
| Home News Product Order Forum Feedback Partner Profile | © Neatware 2000 |