D&D 4E 4e Character XML Schema


log in or register to remove this ad




Document Type Definition

This is the Document Type Definition based off the most recent Cleric sheet. I might have got a couple of things wrong because I don't write DTDs very often.

Code:
<!DOCTYPE character [
	<!ELEMENT character (name, experience, alignment, race, 
		class, deity, abilityScores, skills, feats, powers, equipment, wealth, current)>
	<!ELEMENT name	(#PCDATA) >
	<!ELEMENT experience (#PCDATA) >
	<!ELEMENT alignment (#PCDATA) >
	
	<!ELEMENT race (choice*) >
	<!ATTLIST race name CDATA #REQUIRED>
	
	<!ELEMENT class EMPTY>
	<!ATTLIST class name CDATA #REQUIRED>
	
	<!ELEMENT deity (#PCDATA) >
	
	<!ELEMENT abilityScores (strength, constitution, dexterity, intelligence, wisdom, charisma) >
	<!ELEMENT strength (#PCDATA) >
	<!ELEMENT constitution (#PCDATA) >
	<!ELEMENT dexterity (#PCDATA) >
	<!ELEMENT intelligence (#PCDATA) >
	<!ELEMENT wisdom (#PCDATA) >
	<!ELEMENT charisma (#PCDATA) >
	
	
	<!ELEMENT skills (skill*) >
	<!ELEMENT skill (#PCDATA) >
	
	<!ELEMENT feats (feat*) >
	<!ELEMENT feat EMPTY >
	<!ATTLIST feat name CDATA #REQUIRED >

	
	<!ELEMENT powers (atWill*,encounter*,daily*,utility*) >
	<!ELEMENT atWill (#PCDATA) >
	<!ELEMENT encounter (#PCDATA) >
	<!ELEMENT daily (#PCDATA) >
	<!ELEMENT utility (#PCDATA) >
	
	<!ELEMENT equipment (item*) >
	<!ELEMENT item (#PCDATA) >
	<!ATTLIST item quantity CDATA "1" >
	<!ATTLIST item units CDATA #IMPLIED >
	
	<!ELEMENT wealth (valuable*) >
	<!ELEMENT valuable (#PCDATA) >
	<!ATTLIST valuable quantity CDATA "1" >
	<!ATTLIST valuable value CDATA #REQUIRED >
	
	<!ELEMENT current (hitPoints?, healingSurges?, actionPoints?, condition*, usedPower* ) >
	<!ELEMENT hitPoints (#PCDATA) >
	<!ELEMENT healingSurges (#PCDATA) >
	<!ELEMENT actionPoints (#PCDATA) >
	<!ELEMENT condition (#PCDATA) >
	<!ELEMENT usedPower (#PCDATA) >
	
	
	<!ELEMENT choice (#PCDATA) >
	<!ATTLIST choice tag CDATA #REQUIRED >
]>
 

Less alliteratively - as you probably know, DTDs and XSDs are both forms of XML schema. DTDs are older and somewhat deprecated, though there's nothing wrong with using them if people want - however, if this is to become a community standard I think that we should be careful to keep things in sync.

With that in mind, I'd suggest autogenerating the DTD schema from the XSD schema ("4eCharacter.xsd" I believe) rather than manually writing it, because of a) the effort of keeping them up to date with each other b) the possibility that errors will creep in.
 

Ha, silly me. I didn't even realize that you included that in your file. Shows how little I know.

Edit: Since it is included on the official character sheet I suggest we include:

player
height
weight
gender

and possibly affiliation.
 
Last edited:

dragon_eater said:
Ha, silly me. I didn't even realize that you included that in your file. Shows how little I know.

Edit: Since it is included on the official character sheet I suggest we include:

player
height
weight
gender

and possibly affiliation.
Good points on player, height, and weight, but gender's actually already in there. If you take a look at 4eCharacter.rnc in the .zip, you'll see a pretty human-readable version of the schema. 4eCharacter.xsd has all the same information, but is much nastier on the eyes. :)

I'll add a "campaign" block and a "description" block for more of the stuff from the official character sheet.
 

I looked over the schema but I guess I just missed gender.


I checked the different races against the schema and they all work well. The only weird one Dragonborn because their choice is what attribute and element is used for their breath weapon.

Here is what I got. (Not every interesting I know).

Code:
<race name="Dragonborn">
	<choice tag="Dragon Breath Element">Fire</choice>
	<choice tag="Dragon Breath Ability Score">Strength</choice>
</race>

<race name=Dwarf" />

<race name="Eladrin">
	<choice tag="Eladrin Education">Arcana</choice>
</race>

<race name="Elf" />

<race name="Half-elf" >
	<choice tag="Language">Draconic</choice>
	<choice tag="Dilettante">Cleave</choice>
</race>

<race name="Halfling">
	<choice tag="Language">Goblin</choice>
</race>

<race name="Human">
	<choice tag="Ability Score Boost">Strength</choice>
	<choice tag="Language">Draconic</choice>
	<choice tag="Bonus At-Will Power">Cleave</choice>
	<choice tag="Bonus Feat">Power Attack</choice>
	<choice tag="Bonus Skill">Arcana</choice>
</race>

<race name="Tiefling">
	<choice tag="Language">Draconic</choice>
</race>
 

dragon_eater said:
I looked over the schema but I guess I just missed gender.


I checked the different races against the schema and they all work well. The only weird one Dragonborn because their choice is what attribute and element is used for their breath weapon.

Here is what I got. (Not every interesting I know).
Looks good! Thanks for bashing that out, it's good to know that the "name plus choices" thing works well for all the races.

I've put together another revision, this time with rituals, description and campaign information (all optional). If you choose to include campaign information, then player and DM are required.
 

Attachments


Remove ads

Top