Defining the Content DTD
The DTD that defines the valid structure of any XML loan document is
shown in Listing 12.1. The root of the document is a loan element that has attributes to
define the princi-pal, the term in months, interest rate, and optionally the
monthly payment (because this can be derived from the former three attributes)
of the loan. This root element contains a payment child element for each monthly payment on the loan. Each payment element contains attributes that define
the index of the monthly payment over the lifetime of the loan, the principal
and interest components of the payment, as well as the outstanding principal on
the loan at the point of that payment.
LISTING 12.1 Loan.dtd—Sample
Loan DTD
<?xml version=’1.0’ encoding=’UTF-8’ ?>
<!ELEMENT loan (payment+)>
<!ATTLIST loan principal CDATA #REQUIRED
termInMonths CDATA #REQUIRED
interestRate CDATA #REQUIRED
monthlyPayment CDATA #IMPLIED >
<!ELEMENT payment EMPTY>
<!ATTLIST payment monthIndex CDATA #REQUIRED
principalPayment CDATA #REQUIRED
interestPayment CDATA #REQUIRED
principalOutstanding CDATA #REQUIRED >
Related Topics
Privacy Policy, Terms and Conditions, DMCA Policy and Compliant
Copyright © 2018-2024 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.