Comparison in XML and comparison in XML

Source: Internet
Author: User

Comparison in XML and comparison in XML

After watching the four sets of XML videos in a vague manner, nothing is left in the head. However, I would like to summarize the comparison between XML and HTML and Schema and DTD.

Comparison Between XML and HTML:

1. XML and HTML are both Markup languages. XML can be extended, while HTML cannot be extended.
2. XML Allows defining (unlimited) tags, and allows nested information structures, while HTML is a fixed tag.
3. XML provides a common method for directly "processing" Web data, while HTML is only a common method for "Displaying" Web data. XML focuses on the "content" of the web page, while HTML focuses on the "display format" of the page ".
4. XML enables machines to talk (automatically process information). HTML facilitates communication between people (only the initial stage of the network ).
HTML is still the easiest way to quickly publish data on the Web, most of which are short-term data, such as meeting agenda or advertising brochures. If the data will be used for a long time and requires more structures, you are still willing to use XML.

Comparison between Schema and DTD:

1. Both Schema and DTD are used to define the usage specification of XML tags in various files .. Schema is a standard XML file, while DTD uses its own special syntax. Therefore, you only need to know the XML syntax rules to write the Schema, and you do not need to learn other syntax rules. it can be interpreted using the same processor.

2. schema uses the namespace to associate special nodes in the file with the Schema description. an XML file can have multiple corresponding schemas, a dtd can only have one corresponding DTD file.
3. the Schema content model is open and can be expanded at will, while the DTD cannot interpret the expanded content .. The DTD can only define the file type as a string, while the Schema can define the file type as an integer, floating point, String, Boolean value, or other data types without redefinition.
4. The obvious advantage of Schema over DTD is that the Schema file itself is also an XML file, rather than using a special format like DTD. This facilitates users and designers because they can use the same tools to process and develop, Schema and other XML data without using specialized development or processing tools.

The last Schema replaces DTD, while XML cannot replace HTML.


Which of the following methods can be used for xml parsing?

It's almost the same. You just need to learn one of the classes written by others. The essence is to look at dom and sax. I often use JDOM

How many forms does an XML document define? What is the essential difference between them? How can I Parse XML documents?

A: Two forms of dtd schema. B: essential difference: the schema itself is xml and can be parsed by the XML Parser (this is also the fundamental purpose of developing the schema from the DTD). c: DOM, SAX, STAX, etc.
DOM: when processing large files, its performance drops sharply. This problem is caused by the DOM tree structure. This structure occupies a large amount of memory and the DOM must load the entire file into the memory before parsing the file, which is suitable for Random Access to XML.
SAX: it does not exist in DOM. SAX is an event-driven XML parsing method. It reads XML files sequentially without loading the entire file at a time. When a file starts with a file, the document ends, or the tag starts with a tag, it triggers an event. You can write the processing code in the callback event to process the XML file, suitable for sequential access to XML
STAX: Streaming API for XML (StAX)

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.