search
  • Sign In
  • Sign Up
Password reset successful

Follow the proiects vou are interested in andi aet the latestnews about them taster

XML terminology

Dec 23, 2016 am 11:57 AM
xml


Outline:



Introduction

1. Terms related to XML documents

2. Terms related to DTD



Introduction



The most troublesome thing for beginners to learn XML is that there are a lot of new terminology concepts. understand. Since XML itself is also a brand-new technology, it is constantly developing and changing. Organizations and major network companies (Microsoft, IBM, SUN, etc.) are constantly introducing their own insights and standards, so it is not surprising that new concepts are flying everywhere. . There is no authoritative institution or organization in China to officially name these terms. Most of the Chinese textbooks you see about XML are translated based on the author's own understanding. Some are correct and some are wrong, which further hinders the development of XML. Our understanding and learning of these concepts.




The explanation of XML terms you will see below is also the author’s own understanding and translation. Ajie is based on the XML1.0 standard specification released by the W3C organization and related official documentation. It can be ensured that these understandings are basically correct, at least not wrong. If you want to read and understand further, I have listed the sources and links to relevant resources at the end of this article, which you can access directly. Okay, let’s get to the point:


1. Terms related to XML documents

What is an XML document? You know the HTML source code file? An XML document is an XML source code file written with XML tags. XML documents are also ASCII plain text files that you can create and modify using Notepad. The suffix name of XML documents is .XML, for example, myfile.xml. You can also directly open the .xml file using IE5.0 or above browsers, but what you see is the "XML original code" and the page content will not be displayed. You can try saving the following code as myfile.xml:


<?xml version="1.0" encoding="GB2312"?>

<myfile>

<title>XML Easy Learning Manual&lt ;/title>

<author>ajie</author>

<email>ajie@aolhoo.com</email>

<date>20010115</date>

</myfile&g t;


XML document contains three parts:

1. An XML document declaration;

2. A definition of the document type;

3. Content created with XML tags.


Example:

<?xml version="1.0"?>

<!DOCTYPE filelist SYSTEM "filelist.dtd">


<filelist>

<myfile>

QUICK START OF XML The line <?xml version="1.0"?> is the declaration of an XML document. The second line indicates that this document uses filelist.dtd to define the document type. The following line is the main part of the content.
Let’s learn about the relevant terms in XML documents:


1.Element (element):

We already know something about elements in HTML. It is the smallest unit that makes up an HTML document, and it is the same in XML. An element is defined by a tag, including the start and end tags and the content inside, like this: <author>ajie</author>


The only difference is: in HTML, the tag is fixed, while in In XML, tags need to be created yourself.


2.Tag (logo)

Tag is used to define elements. In XML, tags must appear in pairs, surrounding the data. The name of the identifier is the same as the name of the element. For example, such an element:

<author>ajie</author>

where <author> is the identifier.


3.Attribute:

What is an attribute? Look at this HTML code:<font color="red">word</font>. Among them, color is one of the attributes of font.

Attributes are further descriptions and explanations of the logo. A logo can have multiple attributes, such as the font attribute and size. Attributes in XML are the same as attributes in HTML. Each attribute has its own name and value. The attribute is part of the identifier. Example:

<author sex="female">ajie</author>

Attributes in XML are also defined by yourself. We recommend that you try not to use attributes and change attributes into sub-elements. For example, the above code can Change it to this:

<author>ajie

<sex>female</sex>

</author>

The reason is that attributes are not easy to expand and be manipulated by programs.


4.Declaration

In the first line of all XML documents there is an XML declaration. This declaration indicates that this document is an XML document and which XML version specification it follows. An XML declaration statement looks like this:

<?xml version="1.0"?>


5.DTD (Document Type Definition)

DTD is used to define elements, attributes and elements in XML documents relationship between.

You can check whether the structure of the XML document is correct through the DTD file. But creating an XML document does not necessarily require a DTD file. Detailed descriptions of DTD files will be listed separately below.


6.Well-formed XML (well-formed XML)

A document that abides by XML syntax rules and adheres to XML specifications is called "well-formed". If all your markup strictly adheres to the XML specification, then your XML document does not necessarily need a DTD file to define it.

A well-formed document must start with an XML declaration, for example:

<?xml version="1.0" standalone="yes" encoding="UTF-8"?>

where you must state that the document adheres to The XML version is currently 1.0; secondly, it indicates that the document is "independent", and it does not require a DTD file to verify whether the identification in it is valid; thirdly, it is necessary to indicate the language encoding used in the document. The default is UTF-8. If you use Chinese, you need to set it to GB2312.

A well-formatted XML document must have a root element, which is the first element created immediately after the declaration. Other elements are child elements of this root element and belong to a group of root elements.

The content of a well-formed XML document must comply with XML syntax when written. (We will explain XML syntax in detail in the next chapter)


7. Valid XML (valid XML)

An XML document that abides by XML syntax rules and complies with the corresponding DTD file specifications is called a valid XML document. Note that we compare "Well-formed XML" and "Valid
XML". The biggest difference between them is that one fully complies with the XML specification and the other has its own "Document Type Definition (DTD)".

The process of comparing and analyzing an XML document with its DTD file to see if it complies with DTD rules is called validation. This process is usually handled by a software called parser.

A valid XML document must also start with an XML declaration, for example:

<?xml version="1.0" standalone="no" encode="UTF-8"?>

Different from the above example, In the standalone (independent) attribute, "no" is set here because it must be used with the corresponding DTD. The DTD file is defined as follows:

<!DOCTYPE type-of-doc SYSTEM/PUBLIC "dtd- name">

Among them:

"!DOCTYPE" means you want to define a DOCTYPE;

"type-of-doc" is the name of the document type, which is defined by you. It is usually the same as the DTD file name;

Only use one of the two parameters "SYSTEM/PUBLIC". SYSTEM refers to the URL of the private DTD file used by the document, while PUBLIC refers to the URL of the public DTD file used by the document.

"dtd-name" is the URL and name of the DTD file. All DTD files have the suffix ".dtd".

We still use the above example, it should be written like this:

<?xml version="1.0" standalone="no" encode="UTF-8"?>

<!DOCTYPE filelist SYSTEM "filelist. dtd">

The above is the content of XML terminology. For more related content, please pay attention to the PHP Chinese website (m.sbmmt.com)!



Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

ArtGPT

ArtGPT

AI image generator for creative art from text prompts.

Stock Market GPT

Stock Market GPT

AI powered investment research for smarter decisions

Popular tool

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

JSON vs. XML: Why RSS Chose XML JSON vs. XML: Why RSS Chose XML May 05, 2025 am 12:01 AM

RSS chose XML instead of JSON because: 1) XML's structure and verification capabilities are better than JSON, which is suitable for the needs of RSS complex data structures; 2) XML was supported extensively at that time; 3) Early versions of RSS were based on XML and have become a standard.

RSS in XML: Decoding Tags, Attributes, and Structure RSS in XML: Decoding Tags, Attributes, and Structure Apr 24, 2025 am 12:09 AM

RSS is an XML-based format used to publish and subscribe to content. The XML structure of an RSS file includes a root element, an element, and multiple elements, each representing a content entry. Read and parse RSS files through XML parser, and users can subscribe and get the latest content.

Understanding RSS Documents: A Comprehensive Guide Understanding RSS Documents: A Comprehensive Guide May 09, 2025 am 12:15 AM

RSS documents are a simple subscription mechanism to publish content updates through XML files. 1. The RSS document structure consists of and elements and contains multiple elements. 2. Use RSS readers to subscribe to the channel and extract information by parsing XML. 3. Advanced usage includes filtering and sorting using the feedparser library. 4. Common errors include XML parsing and encoding issues. XML format and encoding need to be verified during debugging. 5. Performance optimization suggestions include cache RSS documents and asynchronous parsing.

XML's Advantages in RSS: A Technical Deep Dive XML's Advantages in RSS: A Technical Deep Dive Apr 23, 2025 am 12:02 AM

XML has the advantages of structured data, scalability, cross-platform compatibility and parsing verification in RSS. 1) Structured data ensures consistency and reliability of content; 2) Scalability allows the addition of custom tags to suit content needs; 3) Cross-platform compatibility makes it work seamlessly on different devices; 4) Analytical and verification tools ensure the quality and integrity of the feed.

Building XML Applications with C  : Practical Examples Building XML Applications with C : Practical Examples May 03, 2025 am 12:16 AM

You can use the TinyXML, Pugixml, or libxml2 libraries to process XML data in C. 1) Parse XML files: Use DOM or SAX methods, DOM is suitable for small files, and SAX is suitable for large files. 2) Generate XML file: convert the data structure into XML format and write to the file. Through these steps, XML data can be effectively managed and manipulated.

RSS, XML and the Modern Web: A Content Syndication Deep Dive RSS, XML and the Modern Web: A Content Syndication Deep Dive May 08, 2025 am 12:14 AM

RSS and XML are still important in the modern web. 1.RSS is used to publish and distribute content, and users can subscribe and get updates through the RSS reader. 2. XML is a markup language and supports data storage and exchange, and RSS files are based on XML.

XML in C  : Handling Complex Data Structures XML in C : Handling Complex Data Structures May 02, 2025 am 12:04 AM

Working with XML data structures in C can use the TinyXML or pugixml library. 1) Use the pugixml library to parse and generate XML files. 2) Handle complex nested XML elements, such as book information. 3) Optimize XML processing code, and it is recommended to use efficient libraries and streaming parsing. Through these steps, XML data can be processed efficiently.

Beyond Basics: Advanced RSS Features Enabled by XML Beyond Basics: Advanced RSS Features Enabled by XML May 07, 2025 am 12:12 AM

RSS enables multimedia content embedding, conditional subscription, and performance and security optimization. 1) Embed multimedia content such as audio and video through tags. 2) Use XML namespace to implement conditional subscriptions, allowing subscribers to filter content based on specific conditions. 3) Optimize the performance and security of RSSFeed through CDATA section and XMLSchema to ensure stability and compliance with standards.

Related articles