Intimate contact XML (5)---XML element

Source: Internet
Author: User
Tags date closing tag
Xml

XML element
XML elements are extensible and associated with each other. The naming rules for XML elements are simple.

XML elements are extensible

XML documents can be extended to carry more information. Take a look at the following XML note example:

< note>
< to>tove</to>
< from>jani</from>
< Body>don ' t forget me this weekend!</body>
</note>

Imagine that we created an application that extracts the < to>, < from>, and < body> elements from an XML document and generates such output:

Message

To:tove
From:jani

Don ' t forget me this weekend!

If the author of this XML document adds some additional information to it:

< note>
< date>1999-08-01</date>
< to>tove</to>
< from>jani</from>
< heading>reminder< Body>don ' t forget me this weekend!</body>
</note>

So will this application fail? No, the application will still generate the same output from the XML document by finding the < To>, < from>, and < body> elements. XML documents can be extended.

XML elements are associated with each other

The relationship between them is like the relationship between parents and children. To understand the terms of XML, you must know the relationship between the naming of XML elements and the description of XML elements. Here is a description of the book:

Book Title:my-I XML

Chapter 1:introduction to XML

What is HTML
What is XML
Chapter 2:xml Syntax

Elements must have a closing tag
Elements must be correctly nested


The following XML document describes the book:

< book>
< title>my-xml</title>
< prod id= "33-657" media= "paper" ></prod>
< Chapter>introduction to XML
< Para>what is html</para>
< Para>what is xml</para>
</chapter>

< Chapter>xml Syntax
< para>elements must have a closing tag</para>
< para>elements must be properly nested</para>
</chapter>

</book>

Here, the book is the root element, and title and chapter (title and chapter) are the child elements of books. Book is the parent element of title and chapter. Title and chapter are sibling elements (or sister elements) because their parents are the same.




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.