Five questions per day

Source: Internet
Author: User
Tags xml parser xsl

1. What is the difference between int and integer?

For:
int is one of the eight basic data types (byte,shor,int,long,char,boolean,float,double) of Java.
The Java language provides a wrapper class for eight basic data, an integer corresponding to a wrapper class of type int, or an int type to be wrapped as an object.

2.DOM parsing differs from sax parsing?

For:
SAX: can only read, can not be modified, only sequential access, suitable for large-scale XML parsing, parsing speed!
DOM: not only can read, but also can be modified, and can achieve random access, the disadvantage is that the resolution is slow, only suitable for parsing small documents
Slow parsing (to generate a node tree in memory, spanning tree is time consuming)
SAX: applied to XML that holds a large amount of data (why do you want to save a large amount of data classes with XML?) Answer: Heterogeneous systems can be implemented
Data access to achieve cross-platform! )
DOM: general application with small configuration XML, convenient for us to operate!

The pros and cons of 3.XML and JSON format?

For:

XML Benefits:

    • 1) The complete separation of the content and structure of the XML document provides significant benefits for XML applications. Based on this feature, the enterprise system can easily achieve a thorough separation of content management and process management, for example, the system architect can focus on the interface definition of each link in the process, while the departments can focus on the content release and maintenance. For example, Microsoft's product BizTalk is leveraging the characteristics of XML content and structure separation to achieve the separation of content and process definitions. Another widely used application is XSL technology, where XSL can alter the structure of an XML file without affecting the content, due to the separation of the content and structure of the XML file. 2) Interoperability strong most plain text file formats have this advantage. Plain text files can easily traverse firewalls and communicate between different systems on different operating systems. As a plain text file format, XML also has this advantage. 3) Standardize the unified XML has a unified standard syntax, any system and products supported by the XML document, all have a uniform format and syntax. This makes XML a cross-platform cross-system feature. In contrast, as a text language, JavaScript is far more uniform than XML, so that the same static pages often produce different results in different browsers, and script programmers often need to struggle to determine the script version supported by the client at the entrance of the program. 4) Support for multiple encodings relative to ordinary text documents, the XML document itself contains the records of the encoding used, which facilitates the processing of the data by the multilingual system. 5) Scalability
      Application Scenario Web service, the continuity between different operating systems can be
JSON Benefits:

</pre><pre name= "code" class= "HTML" > First, convenient foreground data operation. Second, the data volume is small and the transmission is fast. 3rd, when the client manipulates XML, it needs to create an ActiveX object. JSON is exactly a JS object and does not need to create a DOM.


Difference:

    • In terms of readability, the data readability of JSON and XML is basically the same. JSON and XML are comparable in readability, with the suggested syntax on one side and the canonical label form on the other, which makes it difficult to distinguish between the winners and losers.

    • In terms of extensibility, XML is inherently well-extensible, and JSON, of course, has nothing to do with XML extension, which JSON cannot.

    • In terms of coding difficulty, XML has a wealth of coding tools, such as dom4j, Jdom, and so on, JSON also has json.org provided tools, but the JSON encoding is much easier than XML, even if the use of tools can write JSON code, but to write good XML is not easy.

    • In the decoding difficulty aspect, the parsing of XML takes the child node parent node, makes the person dizzy, but the JSON parsing difficulty is almost 0. This is a little bit of XML output.

    • In terms of popularity, XML has been widely used in the industry, and JSON has only just begun, but in the specific area of Ajax, the future development must be XML to be located in JSON. Ajax should turn into Ajaj (asynchronous
      Javascript and JSON).

    • JSON and XML also have rich parsing tools.

    • JSON is a small volume of data relative to XML.

    • JSON interacts more easily with JavaScript.

    • JSON is less descriptive of the data than XML.

    • JSON is much faster than XML.


4. What is the difference between a DTD and an XML schema?

For:
**DTD differs from XML Schema in that **DTD is not written in XML and XML schema itself is an XML file, which means that an XML parser, and so on, can be used to process XML schemas. And the XML Schema is designed after the DTD, which provides more types to map the different data types of the XML file. A DTD, document type definition, is the traditional way to define the structure of an XML file.

5. What are the common ways to parse XML?

For:
SAX, DOM, JDOM, dom4j



Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Five questions per day

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.