tanszek:oktatas:techcomm:xml_2

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
tanszek:oktatas:techcomm:xml_2 [2024/10/07 17:25] – created kneheztanszek:oktatas:techcomm:xml_2 [2024/10/07 17:30] (current) – [XML Namespaces] knehez
Line 2: Line 2:
  
 <sxh xml> <sxh xml>
-<?xml version='1.0' encoding='ISO-8859-2' ?>+<?xml version='1.0' encoding='UTF-8' ?>
 <!-- first XML example --> <!-- first XML example -->
 <message id="123456"> <message id="123456">
Line 55: Line 55:
 Since creators of XML documents use their own vocabulary to build XML, **name conflicts** are possible. For example, the ''<student>'' tag might be too generic. Using **namespace prefixes**, the element can be specialized:  Since creators of XML documents use their own vocabulary to build XML, **name conflicts** are possible. For example, the ''<student>'' tag might be too generic. Using **namespace prefixes**, the element can be specialized: 
  
- +<sxh xml> 
-    <miskolc:student>Johj Smith</miskolc:student>  +<miskolc:student>John Smith</miskolc:student>  
 +</sxh>
  
 Here, the qualified element is ''student'' and the namespace prefix is ''miskolc''. Here, the qualified element is ''student'' and the namespace prefix is ''miskolc''.
Line 72: Line 72:
  
 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. 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 ===
 +
 +<sxh xml>
 +<root><element>abc</element><a>this worng<b></root>
 +</sxh>
 +
 +This XML is **syntactically incorrect** because the `<a>` tag is not closed.
 +
 +=== Example ===
 +
 +The following example is neatly formatted but still **not well-formed**:
 +
 +<sxh xml>
 +<CONTACT>
 +   <NAME>Frank Lee</NAME>
 +   <EMAIL>flee@flee.com
 +</CONTACT>
 +</sxh>
 +
 +Here’s the correct version:
 +
 +<sxh xml>
 +<CONTACT>
 +   <NAME>Frank Lee</NAME>
 +   <EMAIL>flee@flee.com</EMAIL>
 +</CONTACT>
 +</sxh>
 +
 +What’s the difference? In the incorrect version, the `<EMAIL>` tag is not closed, causing the document to be invalid, even though it is visually well-structured.
tanszek/oktatas/techcomm/xml_2.1728321903.txt.gz · Last modified: 2024/10/07 17:25 by knehez