Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of XML and HTML

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

Editor to share with you the example analysis of XML and HTML, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

XML and HTML

First of all, XML, like HTML, is a markup language.

XML was not designed to drive HTML off the altar. In fact, XML was designed for a different purpose.

XML is designed to transmit information, and HTML is designed to display information

What tags HTML can have, no tags, are constrained by a series of specifications http://www.php.cn/code/12132.html" target= "_ blank" >

In XML, however, you can define your own tags.

What's the use of XML?

Because XML is in plain text format, it is independent of any hardware and software and is a true cross-platform data transmission format.

On the basis of XML, many other technologies have been born. For example, the web service,WSDL mechanism that we are most familiar with is implemented based on XML (and some based on JSON).

This is all due to the fact that XML is a very scalable data transfer format.

rule of grammar

Must be related to closed label

For example, & lta >, there must be a corresponding match, of course & lta name= "" / > is an abbreviation.

Case sensitive

The XML document must have a root element

Attribute values must be in quotation marks

Escape of special characters

< - - >

& apos; -'"-"

Annotation

Element naming rules

Names can contain letters, numbers, and other characters

Names cannot start with numbers or punctuation

The name cannot start with the character "xml" (or XML, Xml)

The name cannot contain spaces

Attribute

The attribute must be in quotation marks. If the attribute itself has double quotation marks, surround it in single quotation marks

XML verification

There are many ways to verify that the XML format is good. There are two commonly used ones:

XML DTD

XML Schema

XML DTD

A legitimate XML document is a "well-formed" XML document that also follows the syntax rules of the document type definition (DTD):

GeorgeJohnReminderDon't forget the meeting!

In the above example, the DOCTYPE declaration is a reference to an external DTD file. The following paragraphs show the contents of this file.

] > XML Schema

The W3C supports a XML-based DTD replacement called XML Schema:

XML Namespace

The main purpose of namespaces is to resolve element naming conflicts. The following two XML configuration files have naming conflicts:

Apples Bananas African Coffee Table 80 120

Use namespaces to resolve post-conflict:

Apples Bananas African Coffee Table 80 120

The value of the namespace xmlns attribute does not mean much in itself, just to distinguish between different namespaces, but in fact xmlns will be used by developers to identify certain resources.

XML CDATA

The text in all XML documents is parsed by the parser.

Only the text in the CDATA section (CDATA section) is ignored by the parser.

PCDATA

PCDATA refers to the parsed character data (Parsed Character Data).

The XML parser usually parses all the text in the XML document.

When a XML element is parsed, the text between its tags is also parsed:

This text will also be parsed

The parser does this because the XML element can contain other elements, as in this case, the element contains the other two elements (first and last):

BillGates

And the parser breaks it down into child elements like this:

Bill GatesCDATA

The term CDATA refers to text data (Unparsed Character Data) that should not be parsed by an XML parser.

In the XML element, "" ends:

In the above example, the parser ignores everything in the CDATA section.

Comments on the CDATA section:

The CDATA section cannot contain the string']] >'. Nested CDATA parts are also not allowed.

The'] >'at the end of the tag CDATA section cannot contain spaces or line breaks.

The above is all the content of this article "sample Analysis of XML and HTML". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report