Zoo tutorials: [ SQL | Linux | XML ]

A Gentle Introduction to xml

The plus operator

The expression A+ allows for one or more A nodes.

Rule to be enforced:

The dtd given is not correct.


ValidInvalid
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE module SYSTEM "module.dtd">
<module>
  <name>XML 3</name>
  <teacher>Andrew</teacher>
  <prerequisite>Programming 2</prerequisite>
</module>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE module SYSTEM "module.dtd">
<module>
  <name>XML5</name>
  <!-- no teacher -->
  <prerequisite>XML 3</prerequisite>
  <prerequisite>Web Scripts 3</prerequisite>
</module>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE module SYSTEM "module.dtd">
<module>
  <name>Database 2</name>
  <teacher>Andrew</teacher>
  <teacher>Ken</teacher>
</module>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE module SYSTEM "module.dtd">
<module>
  <name>XML3</name>
  <name>IML3</name>
  <!-- Two names -->
  <teacher>Ken</teacher>
  <prerequisite>XML 3</prerequisite>
  <prerequisite>Web Scripts 3</prerequisite>
</module>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE module SYSTEM "module.dtd">
<module>
  <name>XML4</name>
  <teacher>Ken</teacher>
  <prerequisite>XML 3</prerequisite>
  <prerequisite>Web Scripts 3</prerequisite>
</module>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE module SYSTEM "module.dtd">
<module>
  <name>XML3</name>
  <teacher>Andrew</teacher>
  <room>A17</room>
  <!-- no such node allowed -->
</module>