XML file DTD path parsing (in eclipse)

Source: Internet
Author: User
From: http://51dev.com/program/java/1/20070818/10971.html
1. The path of the DTD file declared by the XML file is as follows:

String 7

"http://java.sun.com/dtd/ejb-jar_2_0.dtd">

。。。。。。

2. DTD statement parsing principles:

String 4

The doctype Declaration contains not only common keywords and root element names, but also external DTD source keywords and DTD locations. The XML specification defines several acoustic source methods. The system or public keyword can be used in the Declaration. If the system keyword is used, the parser will only search for the DTD Based on the given URL? The DTD is explicitly located through the URL.

String 6

However, if the DTD source keyword is public, the situation is slightly more complex. The public keyword is used to declare a well-known vocabulary. For example, assume that the publishing industry has reached a lot of consensus on the library type DTD. The document application needs to parse the document based on this vocabulary and may use some policy to locate the DTD. If this DTD is very popular, applications may have local copies. Direct local copy may be more desirable than remote download from a Web server. DTD may be stored in the database, or it can be obtained through other application-related technologies. If the public keyword and Uri are used, the application has the opportunity to use its own algorithm to locate the DTD. A uniform resource identifier (URI) can be a URL or a separate name.

String 1

For example:

String 1


             “http://www.myweb.com/dtd/books.dtd”>

If Uri "Universal/publishing/book" is known to applications that process such documents, the application can find the DTD in a valid way. Maybe we have a parser suitable for this field. It may have a local copy of The DTD, or it can access the DTD maintained by the local database server. The most important thing is that the DTD search method is mainly determined by the doctype declaration application. String 9

Of course, "as we all know" is usually relative. Therefore, xml1.0 allows public declarations to have both public Uris and system identifiers. If you use a document application or parser that cannot locate a DTD from the URI provided by the Public keyword, it must use a system identifier. String 4

In this example, the document designer allows the receiver application to search for a DTD based on the public Uri. If this process fails and we are not familiar with the publishing field, the general parser is generally in this case, the application can.

String 9

String 7

3. Configure the DTD path in eclispe: String 5

If the ejb-jar.xml file DTD path is not configured in the initial state and eclipse cannot go to Sun's validate, eclipse reports an error. String 6

Publicdoctype can be declared based on the ejb-jar.xml file to instruct eclipse to verify with a local DTD file.

String 2

You have declared "-// sunmicrosystems, Inc. // dtdenterprisejavabeans2.0/EN" as an alias for the local DTD file.

String 9

You can use eclipse [xmlcatalog] to configure: String 1

String 5

Add a [userspecifiedentries] to customize the local DTD verification entry:

String 8

[Add ...] À string 9

  

String 4

Save, and right-click on the ejb-jar.xml file-> [validatexmlfile], eclipse prompts that verification is passed, and no error is prompted.

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.