Zoo tutorials: [ SQL | Linux | XML ]

A Gentle Introduction to xml

Using entities
With answers

Using entities

We have a simplification of the xhtml specification.

Rules to be enforced

Change the dtd so that the xml on the left passes validation and the xml on the right fails validation.


ValidInvalid
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE body SYSTEM "body.dtd">
<body>
  <p>one <b>two</b></p>
  <div>three <i>four</i></div>
</body>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE body SYSTEM "body.dtd">
<body>
 <div><p>x</p></div>
</body>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE body SYSTEM "body.dtd">
<body>
  <p>one <b>two</b></p>
</body>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE body SYSTEM "body.dtd">
<body>
 one <i>two</i>
</body>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE body SYSTEM "body.dtd">
<body>
  <p>one <b>two <i>three</i></b></p>
  <div>four <b>four <b>five</b></b></div>
</body>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE body SYSTEM "body.dtd">
<body>
  <p><p/></p>
</body>