==== XML Example ==== Hello World! - **version**: The version number of the XML document. - **encoding**: Character encoding - 'ISO-8859-2' refers to Latin-2 encoding. - **comments**: Comments can be placed between '''', and they can span multiple lines. - **tagging data**: Data is labeled using **tags**. For example, '''', where '''' is the opening tag and '''' is the closing tag. If the tag doesn't contain data, the closing can be simplified like ''''. - In this example, "Hello World!" is stored in the '''' tag. - An XML file contains a **root element** (or **root tag**) to which all other elements belong, in this case ''''. Elements that contain other elements are called **parent elements**, and the elements within them are called **child elements**. - Elements can contain an unlimited number of **attributes** (properties), such as the ''id'' attribute = "123456". Attribute names are not limited in length, but every attribute name must start with a letter. ==== Special Characters in XML ==== In XML, special characters are represented as follows: - ''&'' - ''&'' - ''<'' - ''<'' - ''>'' - ''>'' - ''''' - ''''' - ''"'' - ''"'' ==== CDATA Section === A **CDATA** section can contain embedded data, such as the following example: ==== XML Namespaces ==== Since creators of XML documents use their own vocabulary to build XML, **name conflicts** are possible. For example, the '''' tag might be too generic. Using **namespace prefixes**, the element can be specialized: John Smith Here, the qualified element is ''student'' and the namespace prefix is ''miskolc''. Photo of the university hall In this example, the namespace prefix ''unimiskolc'' is defined to avoid name conflicts, and it links the data to the **www.uni-miskolc.hu** namespace. ==== XML Interpreters ==== **XML interpreters** process XML documents by performing **syntactic validation**. === Definition === An XML document is considered **"well-formed"** if it is **syntactically flawless**. This means: - It has a **single root element**. - Every opening tag has a corresponding closing tag. - The attributes are properly specified. Therefore, the term **"well-formed"** does not refer to the visual formatting of the XML file with tabs, spaces, or its human-readable structure! === Example === abcthis worng This XML is **syntactically incorrect** because the `` tag is not closed. === Example === The following example is neatly formatted but still **not well-formed**: Frank Lee flee@flee.com Here’s the correct version: Frank Lee flee@flee.com What’s the difference? In the incorrect version, the `` tag is not closed, causing the document to be invalid, even though it is visually well-structured.