Lan Chengdu to organize Java programmer's 10-way XML face question

Source: Internet
Author: User
Tags cdata extend xml cdata xml parser xml stylesheet xpath xsl file xslt

Blue Gull Chengdu we have compiled 10 common XML interview questions, most of which will be asked in the Java INTERVIEW. XML is not dependent on other programming languages, and as well as SQL is one of the skills that programmers need, so it makes sense to prepare some XML questions before any technical job INTERVIEW.

XML Interview Quiz

These questions are not difficult but cover some important areas of XML technology, such as Dtd,xml schema,xslt transformations, XPath retrieval, xml bindings, XML parsers, and XML basics such as namespaces, checksums, attributes, elements, and so On.

What is the problem 1:xml?

A: XML can extend Markup language (extensible
Markup language), You can extend the XML according to your NEEDS. XML can be easily defined <books>, <orders> custom tags, and other markup languages such as HTML must use predefined tags, such as <p>, instead of using user-defined tags. Standardize the XML structure using DTDs and XML Schemas. XML is primarily used for data transfer from one system to another, such as client and server for enterprise Applications.

What is the difference between a problem 2:dtd and an XML schema?

A: The DTD differs from the XML schema in that the DTD is not written with XML and XML
The schema itself is an XML file, which means that existing XML tools, such as the XML parser, can be used to manipulate 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.

What is the problem 3:xpath?

A: XPath is an XML technique for retrieving elements from an XML document. XML documents are structured so that XPath can locate and retrieve elements, attributes, or values from an XML file. XPath is similar to SQL in terms of data retrieval, but it has its own syntax and Rules.

What is the problem 4:xslt?

A: XSLT is also a common XML technique used to convert an XML file to another xml,html or other format. XSLT defines its own syntax, functions, and operators in detail for the transformation XML file. The transformation is typically done by the XSLT engine, which reads the instruction of an XML stylesheet or XSL file written by the XSLT syntax. The XSLT heavily uses recursion to perform transformations. A common XSLT use is to display the data in an XML file as an HTML Page. XSLT can also easily convert an XML file to another XML Document.

Question 5: What are XML elements and attributes

A: It's best to give an example to Explain. The following is a simple XML fragment.

1 <Orders>

2 <order id= "123" >

3 <Symbol>6758.T</Symbol>

4 <Price>2300</Price>

5 <Order>

6 <Orders>

In the example, the ID is an attribute of the element, and no other element has a Property.

Question 6: what is well-formed XML

A: This problem is often seen in telephone interviews. A well-formed XML means that the XML document is syntactically correct, for example, it has a root element, all open tags are properly closed, attribute values must be quoted, and so On. If an XML is not well-formed, it may not be handled and parsed correctly by various XML parsers.

What is the problem 7:xml namespace? Why is it important?

A: The XML namespace is similar to the Java package, and is used to avoid conflicting labels with different source Names. The XML namespace is defined with the xmlns attribute at the top of the XML document, with the syntax xmlns:prefix= ' URI '. The prefix is used with the actual tags in the XML document. The following example is the use of an XML namespace.

1<root xmlns:inst= " cd.lanou3g.com "

2 <inst:phone>

3 <inst:number>837363223</inst:number>

4 </inst:phone>

5</root>

What is the difference between the problem 8:dom and the sax parser?

Answer: This is a common interview problem, not only in the XML interview questions, in the Java interview will also Ask. The main difference between the DOM and the SAX parser is how they parse the XML document. With DOM parsing, the XML document is loaded into memory as a tree structure, and sax is an Event-driven parser. This question is answered in more detail to see the difference between the DOM and the sax Parser.

Question 9:xml CDATA What is

A: The problem is simple and important, but many programmers don't know much about it. CDATA refers to character data, which has special instructions that are parsed by the XML parser. The XML parser parses all the text in the XML document, such as <name>this is name of person</name> the value of the tag is also parsed because the tag value may also contain XML tags, such as <name>< Firstname>first
Name</firstname></name>. CDATA Parts are not parsed by the XML parser. CDATA section with <! [cdata[begins, ends with]]>.]

What is the XML data binding for problem 10:java

A: Java's XML binding refers to the creation of classes and objects from XML files, and the use of the Java programming language to modify XML Documents. The Xml-bound Java API,JAXB provides a convenient way to bind XML documents and Java Objects. Another alternative XML binding method is to use an open source library, such as XML Beans. One of the biggest benefits of XML binding in Java is the ability to create and modify XML documents using Java programming Capabilities.

The above XML interview questions are collected from many programmers, but they are useful to everyone who uses XML technology. XML is becoming more and more important because of its platform independence, and XML is widely used for cross-platform data transmission (xpath,xslt,xquery). Although XML has drawbacks such as redundancy and large document size, it plays a significant role in data transfer between Web services and systems with bandwidth and rate as a secondary consideration.

Blue Gull Chengdu Java Organize push

Lan Chengdu to organize Java programmer's 10-way XML face question

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.