XML recommends using attributes first

Source: Internet
Author: User

Important: It is recommended that you record data in a way that takes precedence over attributes, unless you also need to include hierarchical data.

Advantages:

1. Can completely cover the relational database data format design, conducive to exchange.

2. Small footprint. Equivalent to the JSON format, there is no longer a large number of duplicate node name suffixes (including elements and child elements):

2.1 attribute mode, Memory consumption 577 bytes:

<?XML version= "1.0" encoding= "UTF-8"?><Basis><!--This is a database of Buddhist scriptures. -<ContentID= "1"category= "Wisdom"name= "King Kong-like Blessings Sutra"version= "1"/><ContentID= "1"category= "Wisdom"name= "King Kong-like Blessings Sutra"version= "1"/><ContentID= "1"category= "Wisdom"name= "King Kong-like Blessings Sutra"version= "1"/><ContentID= "1"category= "Wisdom"name= "King Kong-like Blessings Sutra"version= "1"/><ContentID= "1"category= "Wisdom"name= "King Kong-like Blessings Sutra"version= "1"/><ContentID= "1"category= "Wisdom"name= "King Kong-like Blessings Sutra"version= "1"/></Basis>

2.2 element mode, memory consumption 781 bytes:

<?XML version= "1.0" encoding= "UTF-8"?><Basis><!--This is a database of Buddhist scriptures. -<Content><ID>1</ID><category>Prajna</category><name>King Kong-like Blessings Sutra</name><version>1</version></Content><Content><ID>1</ID><category>Prajna</category><name>King Kong-like Blessings Sutra</name><version>1</version></Content><Content><ID>1</ID><category>Prajna</category><name>King Kong-like Blessings Sutra</name><version>1</version></Content><Content><ID>1</ID><category>Prajna</category><name>King Kong-like Blessings Sutra</name><version>1</version></Content><Content><ID>1</ID><category>Prajna</category><name>King Kong-like Blessings Sutra</name><version>1</version></Content><Content><ID>1</ID><category>Prajna</category><name>King Kong-like Blessings Sutra</name><version>1</version></Content></Basis>

Recommendation: As long as the XML data format is designed into a relational database format, you can fully use the property to store the data. Using the standard format of the sub-table system to complete the storage of auxiliary data.

XML recommends using attributes first

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.