Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save lhayhurst/2172243 to your computer and use it in GitHub Desktop.
Save lhayhurst/2172243 to your computer and use it in GitHub Desktop.
Character interchange document: Basic DTD + XML, with and without attributes
<?xml version="1.0"?>
<!DOCTYPE character_interchange_document [
<!ELEMENT character_interchange_document (character+)>
<!ELEMENT character (character_name,playername,role)>
<!ELEMENT character_name (#PCDATA)>
<!ELEMENT playername (#PCDATA)>
<!ELEMENT role (#PCDATA)>
]>
<character_interchange_document>
<character>
<character_name>harsk</character_name>
<role>npc</role>
<playername>bob</playername>
</character>
</character_interchange_document>
<?xml version="1.0"?>
<!DOCTYPE character_interchange_document [
<!ELEMENT character_interchange_document (character+)>
<!ELEMENT character EMPTY>
<!ATTLIST character
name CDATA #REQUIRED
playername CDATA #REQUIRED
role (pc | npc) "pc"
>
]>
<character_interchange_document>
<character name="harsk" role="npc" playername="bob"></character>
<character name="valeros" role="npc" playername="bill"></character>
</character_interchange_document>
@devonjones
Copy link

Perhaps we can combine the two: https://gist.github.com/2172980

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment