Dr. O. Aly
Computer Science
Introduction
The purpose of this discussion is to discuss and analyze the design of the XML document. The discussion also examines the XML design document from the perspective of the users for improved performance. The discussion begins with XML Design Principles and detailed analysis of each principle. XML design document is also examined from the performance perspective focusing on the appropriate use of elements and attributes when designing XML document.
XML Design Principles
The XML design document has guidelines and principles that developers should follow. These guidelines are divided into four major principles for the use of elements and attributes: core content principles, structured information principle, readability principles, element and attribute binding principles. Figure 1 summarizes these principles of XML design document.

Figure 1. XML Design Document Four Principles for Elements and Attributes Use.
Core Content Principle
The core content principle involves the use of element versus the use of the attribute. If the information is part of the essential material for human-readable documents, the use of elements is recommended. If the information is for machine-oriented records formats, and to help applications process the primary communication, the use of attributes is recommended. Example of this principle includes the title which is replaced in an attribute while it should be placed in element content. Another example of this principle is the internal product identifies thrown as elements into detailed records of the products, while some cases attributes are more appropriate than elements because the internal product code would not be of primary interest to most readers or processors of the document when the ID has an extended format. Similar to data and metadata, the data should be placed in elements, and metadata should be in attributes (Ogbuji, 2004).
Since elements and attributes are the two main building blocks of XML design document, developers should be aware of the legal and illegal elements and attributes. (Fawcett, Ayers, & Quin, 2012) have identified legal and illegal elements. For instance, the spaces are allowed after a name, but names cannot contain spaces. Digits can appear within a name, while names cannot begin with a digit. The spaces can appear between the name and the forward slash in a self-closing element, while the initial spaces are not allowed. A hyphen is allowed within a name, but a hyphen is not allowed as the first character. The non-roman characters are allowed if they are classified as letters by the Unicode specifications, where the element name is forename in Greek, while the start and end tags must match case-sensitively (Fawcett et al., 2012). Table 1 shows the legal and illegal elements when designing XML document.

Table 1. Legal vs. Illegal Elements
Consideration for XML Design Document (Fawcett et al., 2012).
For the attributes, (Fawcett et al., 2012) have identified legal and illegal attributes. The single quote inside double quote delimiters is allowed. The double quotes inside a single quote delimiter are also allowed, while a single quote inside single quote delimiters is not allowed. The attribute names cannot begin with a digit. Two attributes with the same name are not allowed. The mismatching delimiters are not allowed. Table 2 shows the legal and illegal attributes to be considered when designing XML document.

Table 2. Legal vs. Illegal Attributes
Consideration for XML Design Document (Fawcett et al., 2012).
Structured Information Principle
Since the element is an extensible engine for expressing structure in XML, the use of the element is recommended if the information is expressed in a structured form, especially if the structure is extensible. The use of the attribute is recommended if the information is expressed as an atomic token since attributes are designed to express simple properties of the information represented in an element (Ogbuji, 2004). The date is an excellent example as it has a fixed structure and acts as a single token, hence can be used as an attribute. Personal names are recommended to be in the element content, instead of having the names in attributes, since personal names have variable structure, and are rarely an atomic token. The following code example is making the name as an element. Figure 2 shows the name is an element, while Figure 3 shows the name is an attribute.

Readability Principle
If the information is intended to be for human readability, the use of the element is recommended. If the information is for machine readability, the use of the attribute is recommended (Ogbuji, 2004). The URL is an example as it cannot be used without the computer to retrieve the referenced resource (Ogbuji, 2004).
Element/Attribute Binding
The use of element is recommended if its value is required to be modified by another attribute (Ogbuji, 2004). The attribute should provide some properties or modifications of the element (Ogbuji, 2004).
XML Design Document Examination
One of the best practices identified by IBM for DB2 is to use attributes and elements appropriately in XML (IBM, 2018). Although it is identified for DB2, it can be applied to the design of an application using XML document because the elements and attributes are the building blocks of XML as discussed above. The example for the examination involves a menu and the use of elements and attributes.
If a menu for a restaurant is developed using XML design document technique, and the portion sizes of items are placed in the menu, the code content principle is applied with the assumption that it is not important to the reader of the menu format. Following the structured information principle, the code will be as follows by not placing the portion measurement and units into a single attribute. Figure 4 shows the code using the core content principles, while Figure 5 shows the code using the structured information principle.

However, following the structured information principle in Figure xx allows portion-unit to modify the portion-size which is not recommended. The use of the attribute is recommended to modify the element which is the menu-item element in this example. Thus, the solution is to modify the code and make the element to be modified by the attribute portion-unit. The result of this code will show the portion size to the reader as shown in Figure 6.

After the modification of the code to make the element modifiable by the portion-unit, the principles of the core content and readability are applied. This modification contradicts the original decision that it is not essential to the reader to know about the size which is based on the core content principle. Therefore, XML developers should judge the appropriate principle to be applied based on the requirements.
The following link is available, to see another XML design document as a menu example: https://www.w3schools.com/xml/default.asp. The code in the provided link shown in Figure 7 shows that the attributes are modifying the elements which are recommended.

Conclusion
This assignment has focused on the XML design document. The discussion has covered the four major principles that should be considered
when designing XML document. The four principles go around the two building blocks of the attribute and element. The use of the element is recommended for human-readable documents, while the use of the attributes is recommended for machine-oriented records. The use of the element is also recommended for information that is expressed in a structured form, especially if the structure is extensible, while the use of the attributes is recommended for information is expressed as an atomic token. If the attribute modifies another attribute, the use of element is recommended. XML document design should also consider the legal and illegal elements and attributes. A few examples have been provided to demonstrate the use of element versus attributes, and the method to improve the code for good performance as well as for good practice. The discussion was limited to the use of element and attributes and performance consideration from that perspective. However, XML design document involves other performance considerations for XML for the database, for parsing, and for data warehouse as discussed in (IBM, 2018; Mahboubi & Darmont, 2009; Nicola & John, 2003; Su-Cheng, Chien-Sing, & Mustapha, 2010).
References
Fawcett, J., Ayers, D., & Quin, L. R. (2012). Beginning XML: John Wiley & Sons.
IBM. (2018). Best Practices for XML Performance in DB2. Retrieved from https://www.ibm.com/support/knowledgecenter/en/SSEPEK_11.0.0/perf/src/tpc/db2z_bestpractice4xmlperf.html.
Mahboubi, H., & Darmont, J. (2009). Enhancing XML data warehouse query performance by fragmentation. Paper presented at the Proceedings of the 2009 ACM symposium on Applied Computing.
Nicola, M., & John, J. (2003). XML parsing: a threat to database performance. Paper presented at the Proceedings of the twelfth international conference on Information and knowledge management.
Ogbuji, U. (2004). Principles of XML Design: When to Use Elements Versus Attributes. Retrieved from https://www.ibm.com/developerworks/library/x-eleatt/x-eleatt-pdf.pdf.
Su-Cheng, H., Chien-Sing, L., & Mustapha, N. (2010). Bridging XML and relational databases: Mapping choices and performance evaluation. IETE Technical Review, 27(4), 308-317.