XML, or Extensible Markup Language, is a metalanguage which defines markup languages, developed by the World Wide Web Consortium (W3C) and used to store data in a readable format. It originates from the SGML language and can define the syntax of specific languages (as HTML does for the SGML language) in order to structure large documents.

XSQL script uses XML syntax as a language definition base.

# 1 Well-Formed Documents

Well-formed documents have basic definitions of all formats and can be analyzed by any syntax parser which follows rules.

• Documents must follow a hierarchical structure with tags that limit their elements. A tag must be nested in another. Elements with content must be closed correctly.
• XML documents only allow one root element which encloses all others, meaning that only one initial element can exist.
• Attribute values in XML must always be enclosed with single or double quotation marks.
• XML is case-sensitive. There is a set of characters called whitespace (spaces, tabs, carriage return, line feed) that the XML processor treats differently as a type of markup.
• Names must be assigned to structures, element types, entities, particular elements, etc. In XML, names have some characteristic in common.
• Constructions like tags, entity references and declarations are called markup. These are parts of the document that the XML processor expects to understand. The rest of the document between markup is content, data which is human-readable.

# 2 Validity

The well-formed document categorization only refers to its basic syntactic structure; in other words, it is composed of elements, attributes and comments in the way XML specifies they are written. However, for each application of XML, that is, each language defined with this technology, it is necessary to specify exactly which relationship should be verified between different elements present in the document.

Comments can be declared using XML syntax.

# 4 Recommendations

Function arguments and variables are declarative and appear as tags. Therefore, it is not permitted to declare an argument or variable that corresponds to a tag of the language itself (reserved words).

It is recommended to use a p_ prefix to name parameters or local function arguments, and m_ to name the variables of each module.

Dynamic declaration of variables based on SQL statements also exists. Variable names take field names in the database. In these cases, it is crucial to declare a prefix to prevent name collision with reserved words.
Copy
<select prefix='m_'>
<columns>*</columns>
<from table='table_name'/>
<where>id = 1</where>
</select>

In the same way, a function whose name matches a predefined function cannot be declared. Therefore, we recommend the use of well-defined, specific names to declare functions.

# 5 Indentification

Users can indenti code conveniently without affecting its operation, with the exception of tags that process XML CDATA sections, such as print and println.

Observe the following example and exclamations (!):

Copy
<xsql-script>
<body>
<set name='autor'>Mark</set>
<println>!
This is an example of text output.
Sign by
<autor />
!</println>
</body>
</xsql-script>

As you can see, println has processed the entire content of descending nodes, including CDATA. Therefore, in these cases the format is relevant to the output.

However, the use of the trim attribute can prevent the tag from taking previous and subsequent spaces. Through the trim attribute, users can delete previous and subsequent expression spaces.

Copy
<xsql-script>
<body>
<set name='autor'>Mark</set>
<println trim='true'>
This is an example of text output.
Sign by
<string.nl />
<autor />
</println>
</body>
</xsql-script>