Zoo tutorials: [ SQL | Java | Linux | XML ]

A Gentle Introduction to xml

Batches
With answers

Batches

A batch consists of a number of debits followed by a number of credits.

Change the DTD so that the XML on the left passes validation but the XML on the right fails validation. The DTD given is too permissive - it allows any combination of card and cash.

Schema


XML input

ValidInvalid
<batch>
  <debit/>
  <credit/>
</batch>
<batch>
  <debit/>
  <debit/>
  <credit/>
  <credit/>
</batch>
<batch>
  <debit/>
  <debit/>
  <credit/>
</batch>
<batch>
</batch>
<batch>
  <debit/>
  <credit/>
  <credit/>
</batch>
<batch>
  <credit/>
  <debit/>
</batch>