Eclipse adds DTD file to implement XML auto Prompt function

Source: Internet
Author: User

Take Ibatis to write Sql Map Config file As an example, add Sql-map-config-2.dtd to eclipse, so as to get the function of automatic XML prompt, can better follow the Ibatis official definition of the specification to write an XML document.

Remember that there is such a word in XML.

"Http://ibatis.apache.org/dtd/sql-map-config-2.dtd" >

Open Window-->preferences-->xml-->xml Catalog in eclipse

Click the Add button to pop up the dialog box

The location of the DTD file that you downloaded is populated with the native locations;

Key Type Select public ID;

Key fills in the XML document header

It's done!

Now create a new XML try to see ~ ~

The effect came out, very convenient ~ ~

If you're not yet ... Then remember to check the input ...

And remember, the way XML is opened is changed into XML editor.

Here is some understanding of XML and DTDs.

Why joining a DTD would have such a powerful function ...

See the definition of DTD in Baidu Encyclopedia:

(Document Type Definition)

A DTD is a set of syntax rules about tokens. It is part of the XML1.0 version of the specification, which is an XML file validation mechanism that is part of the XML file composition.

DTDs are an effective way to ensure that the XML document is well-formed by comparing XML documents and DTD files to see if the document conforms to the specification and whether the elements and labels are used correctly.

XML files provide a format for the data interchange of the application, and the DTD is what makes the XML file the standard for data exchange, because different companies simply define a standard DTD, and companies can build XML files according to DTDs and validate them, so that standards and exchange of data can easily be established. This satisfies the network share and the data interaction.

The DTD file is an ASCII text file with a suffix called. DTD.

XML files for different purposes will prescribe their own set of DTD documents. An XML file that is used to standardize user writing

Take Ibatis's Sqlmap file as an example

XML code

"Http://ibatis.apache.org/dtd/sql-map-2.dtd" >

! DOCTYPE Specifies the document type definition (DTD) that the document follows, stating that the XML document is parsed in DTD mode.

The string "-//ibatis.apache.org//dtd SQL Map 2.0//en", followed by public, refers to the specified DTD file, which can be considered a unique identifier

"Http://ibatis.apache.org/dtd/sql-map-2.dtd" is the address of the DTD file on the official website

We can use this official website address to download the corresponding DTD file. Add to eclipse.

Eclipse add DTD file to implement XML auto-prompt function

Related Article

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.