Xml – Attributes, Parsers, and Browser Compatibility
Essay Preview: Xml – Attributes, Parsers, and Browser Compatibility
Report this essay
XML – Attributes, Parsers, and Browser Compatibility
As it is generally understood, XML has the purpose of explaining data, pretty much. It has the potential of sharing data the same way across many systems on the Internet. The markup language describes the text in the form of elements and attributes, often to describe these elements. XML documents show this information in a way that web masters or computers both, can read information. The paper will discuss XML attributes, the Microsoft core services of XML, and the further development of XML and XSLT.
XML Attributes
An eXtensible Markup Language (XML) attribute can be defined as a modifier that provides more information about an XML element (W3, 2006). It can provide color, formatting, alignment, or descriptive text (Ray & Ray, 1998, p. 22). Attributes are not limited to just one of the XML family of languages though; Hypertext Markup Language (HTML), XML, Document Type Definition (DTD), and eXtensible Style sheet Language (XSL) all have attributes. HTML attributes such as and are used in formatting output and there are many more. This paper will concentrate only on attributes used between the XML and DTD files that are used for validation of the XML document.
Elements in an XML document could describe a . Simple XML and DTD files describing could look like Table 1.
Table 1
Table 1 describes the XML element and the DTD file that corresponds to the XML file showing exact mapping with no attributes at this time. The DTD file defines the accepted elements of an XML file (W3schools, 2006). This promotes the correct use and formatting of documents. The DTD elements may be included within the XML file for simplicity, but as the XML file grows larger this practice becomes cumbersome, and if the organization wants to share XML documents across the enterprise, a separate DTD file is required.
The XML File with changes for a gender attribute look like Table 2. An XML attribute can be defined as a modifier that provides more information about an element as seen below:
Table 2
Table 2
The XML file for gender declares “Male” as the attribute in single or double quotes and the DTD file declares that three values are allowed Male, Female, and Other. The word “type” links the XML element gender to the DTD gender attribute for the validation. Type may be any word that has meaning to the user. The DTD file would accurately validate gender because Male in the XML file matches one of the three acceptable options in the DTD file.
There are currently no fixed rules or standards about when to use attributes and when to just enter another element. Some say to avoid attributes in XML documents and make them elements. Some say the data in a database should be stored as elements, but metadata (data about data) should be stored as attributes (w3schools, 2006).
Some reasons to avoid attributes are that they are not expandable, they cannot define structures, and theyre not easy to test in a DTD file (w3schools, 2006).
Other examples of DTD elements and their attributes are:
Allow only numbers in the range of 1 through 12.
Allow only the words ARMY or MARINES and if blank ARMY is the default.
Allow only the words AIR or GROUND, and one or the other is REQUIRED.
Allow only numbers in the range of 20 through 100.
This is a date pattern. The pattern allows a date, such as 26042006.
XML Attributes are a powerful markup language addition made up of a wide assortment of options and values to enable the XML developer many chances for effective XML validation thereby producing correct and accurate documents for further use. Within the structure of an element are a myriad of attribute options, such as “PATTERN,” where a whole chapter must be devoted to cover the basic features. XML attributes are a very valuable addition to XML.
The Microsoft XML Core Services
(formerly Microsoft XML Parser)
This section will provide a brief discussion of XML parsers; what a parser is and what a parser does, some different kinds of parsers, the application program interfaces (API) they interact with, and finally, a discussion of the evolution of the Microsoft XML Parser.
Some general facts about parsers.
What is a parser? Parsers are so named because they separate XML information into data and markup so that applications, such as a database or browser, can properly interpret the information. In order to process XML data, applications or services must have access to an XML parser. XML documents must be “well-formed” to be read correctly by a parser. Some parsers check to see if XML documents conform to the XML standard and have a correct structure (validating parsers), and some do not (non-validating parsers). Parsers are essential for automatic processing of XML documents. The parsed data may be displayed in a Web page, or in some other form (Wikipedia.org, 2006).
Two types of parsers. Many mainstream applications come with integrated parsers, such as MSXML Core Services in MS Internet Explorer 6.0, but others, including purpose-built applications, do not. When developing an application it is important to select the right type of parser. Parsers are different not only in their support for checking and transforming documents but also in the way they read a document. Event-based parsers, like those that support the Simple API for XML (SAX), read the text sequentially, and whenever a recognized tag appears an event is sent to the application (Wikipedia.org, 2006).
A second type of parser first builds a hierarchical data structure from the content of the document, and then parses the data to the application. This type of parser supports the Document Object Model (DOM) API. Parsers that generally conform to these two types are often referred to simply as, SAX parsers and DOM parsers, respectively, even though they may not be fully compliant with either SAX or DOM. Also, some newer versions of parsers (MSXML is one)