Effective XML: 50 Specific Ways to Improve Your XML

Attribute declarations also benefit from parameterization. For example, the type attribute of the Transaction element can be declared as follows .

<!ENTITY % TypeAtt "type"> <!ENTITY % type.extra ""> <!ATTLIST %TransactionElement; %TypeAtt; (withdrawal deposit transfer %type.extra;) #REQUIRED>

Now you can change the name of the attribute by redefining the TypeAtt entity or add an additional value by redefining the type.extra entity. For example, the redefinition below adds a balanceInquiry type.

<!ENTITY % type.extra " balanceInquiry ">

Категории