O'Reilly logo

Effective XML: 50 Specific Ways to Improve Your XML by Elliotte Rusty Harold

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Parameterizing Attributes

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 ">

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required