SGML, HTML, and XML are all markup languages, but they have different roles and relationships:
-
SGML (Standard Generalized Markup Language): Think of SGML as the grandparent. It's a very powerful and complex metalanguage – a language for defining other markup languages. It defines the rules for how to create a markup language. It's extremely flexible but also quite difficult to learn and implement.
-
HTML (HyperText Markup Language): HTML is a specific markup language defined using SGML. It's like the child of SGML. It inherits the basic concepts of markup (tags, elements, attributes) from SGML, but it's much simpler and focused specifically on structuring web content for display in browsers. Early versions of HTML were actually SGML applications. However, HTML5, while inspired by SGML, is technically not an SGML application due to some differences in parsing rules. It's better to think of HTML5 as its own standard heavily influenced by SGML.
-
XML (Extensible Markup Language): XML is another offspring of SGML, like a sibling to HTML. It's also a metalanguage, meaning it can be used to define other markup languages. However, it's simpler than SGML while still retaining much of its power. XML is designed to be both human-readable and machine-readable, focusing on describing data rather than displaying it.
-
Relationship between XML and HTML: While both are descendants of SGML, XML and HTML serve different purposes. HTML is focused on presentation (how content looks in a browser), while XML is focused on data structure and transport. They can work together, though. For example, XHTML (Extensible HyperText Markup Language) is a reformulation of HTML as an XML application. This allows for stricter validation and easier parsing, although it's less commonly used now in favor of regular HTML5. Furthermore, XML can be used to store and transport data that is then displayed using HTML. For example, a web application might receive data in XML format and then use that data to dynamically generate HTML for display.
In short:
- SGML is the powerful, complex parent.
- HTML is the child focused on web page display.
- XML is another child focused on data structure.
- XHTML is a grandchild, a version of HTML defined using XML rules.
This family tree analogy helps understand the relationships and the evolution of these important markup languages.
标签:XML,语言,标记,markup,SGML,HTML,focused,data From: https://www.cnblogs.com/ai888/p/18569695