Basic XML knowledge learning

Source: Internet
Author: User

Basic XML knowledge:

XML features: XML has nothing to do with the operating system and programming language development platform.

Implement data interaction between different systems

XML: Extensible Markup Language

HTML:

XML structure:

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

-- XML file declaration Encoding

If you do not write, the default is UTF-8.

<Root element>
<Child element 1 Property = "value">
<Element> value </element>
<Element> value </element>
<Element> value </element>
</Child element 1>
<Child element 2 Property = "value">
<Element> value </element>
<Element> value </element>
<Element> value </element>
</Child element 2>
<Child element 3 property = "value">
<Element> value </element>
<Element> value </element>
<Element> value </element>
</Child element 3>
</Root element>

1. There can be only one root element and multiple child elements

2. XML tags are case sensitive.

3. xml must be correctly nested

Use of the CDATA section:

<? XML version = "1.0" encoding = "UTF-8"?> <Books> <author> Wang Shan </author> <title> XML advanced programming </title> <description> <! [CDATA [describes the writing of null elements, for example, <title> </title> <title/>]> </description> </books>

Annotations in XML: <! -->

For example:
<Contestant>
<Contestant>
<Contestant Name> Wang xianming </contestant Name>
<Expected score> 75 </expected score>
<Actual score> 80 </actual score>
</Contestant>
<Contestant>
<Contestant Name> Zhang Fei </contestant Name>
<Expected score> 90 </expected score>
<Actual score> 80 </actual score>
</Contestant>
<Contestant>

Namespace: <xmlns: tea = "http://www.tea.org">

DTD Technology

Role of a DTD file: used to verify and constrain the format of an XML file

There are three types of DTD documents:

Internal DTD document <! Doctype root element [definition content]>

External DTD document <! Doctype root element system "DTD file path">

Internal and external DTD document <! Doctype root element system "DTD file path" [definition content]>

Example:
 

 <? xml version="1.0"?> <!DOCTYPE poem[    <!ELEMENT peom(author,title,content)>    <!ELEMENT author(#PCDATA)>    <!ELEMENT title(#PCDATA)>    <!ELEMENT content(#PCDATA)> ]>

XML file section

Syntax of elements in DTD:

<! Element name content>

Syntax of attributes in DTD:

<! ATTLIST element name
Attribute name attribute type attribute Characteristics
............
>

The property types include CDATA, ID, idref/idefs, and enumerated.

Attribute features: # required, # implied, # fixed value, and default value

Entity:

Syntax for defining objects: <! Entity entity name "entity value">

Example: <! Entuty writer "Donald Duck">
Example: <! Entuty copyright "Copyright w3schools">



Schema basics:

Root element: Schema

Elements used to define elements and attributes:
 
Element, attribute

Group, attributegroup

Used to define a simple type: simpletype

Used to define a complex type: complextype

Type constraints: choice, list, sequence, Restriction










This article is from The Rock blog, please be sure to keep this source http://chi474879271.blog.51cto.com/9253467/1551703

Basic XML knowledge learning

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.