Internal parameter entity

Source: Internet
Author: User

An entity is a part of a document rather than a DTD. Generic object references can only be used in the positions where the document can be a part of the document in the DTD. generic object references cannot be used to insert texts that are only DTD rather than document content. However, entity references in DTD are usually useful. Therefore, XML provides a way to reference parameter entities.
apart from the following two key points, parameter entity references are very similar to common entity references.
(1) the parameter object reference starts with a percent sign (%) instead of an ampersand.
(2) parameter entity reference can only appear in DTD, but not in document content.
the parameter entity reference method declared in the DTD is similar to that of a common object, but the one hundred Semicolon is added before the object name. The syntax structure is as follows:

the abbreviation of an object name is entity content.


when the parameter entity reference is used to replace the generic Entity reference, the abbreviation (# pcdata) that cannot be implemented in the previous article becomes valid.



the real value of parameter entity reference is displayed in the common list of sub-elements and attribute sharing between elements. If the text block to be replaced is large and used frequently, the reference of the just-parameter object is more useful. For example, assume that the DTD Declaration contains many layered elements, such as paragraph, cell, and heading. Each element has a definite number of inline elements, such as internal elements such as person, degree, model, product, animal, and ingredient. The declaration of these elements may be expressed as follows:

1 <! Element praragraph (person | degree | model | product | antimal | ingredient )* >
2 <! Element cell (person | degree | model | product | antimal | ingredient )* >
3 <! Element heading (person | degree | model | product | antimal | ingredient )* >
4

The container elements have the same settings. Assume that a new element, such as equation, CD, or account, must be declared as a child element of all three elements. If you add a new element to the first two elements, but you forget to add it to the first two elements, this will cause a problem. If the number of elements is 30 or 300, but not 3, the problem will multiply.
If a separate sub-element list is not provided for each container element, it is easier to maintain the new DTD. The alternative method is to change the child element list to a parameter object reference, and then apply the parameter object reference to each element. For example:

1 <! Element % inlines "(person | dergee | model | product | antimal | ingredient )*" >
2 <! Element paragraph % inlines; >
3 <! Element cell % inlines; >
4 <! Element heading % inlines; >
5

When adding a new element, you only need to change a parameter object declaration without changing the three element declarations.





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.