Table of Contents

namegenerator.xsd

If you want to write your own name definition file (or edit an existing one), you have to open it with your text editor. Have a look at the following example:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<NameList>
	<Origin name="Germany">
		<Category name="Female Firstnames">
			<Names>Anne,Anita,Arabella</Names>
		</Category>
		<Category name="Male Firstnames">
			<Names>Andreas,Arnim,Björn,Christian</Names>
		</Category>		
		<Category name="Surnames">
			<Names>Arndt,Beine,Bergen,Brecht,Eichel</Names>
		</Category>		
	</Origin>

	<NameDefinition name="German Female">
		<NameRef Origin="Germany" Category="Female Firstnames"/>		
		<NameRef Origin="Germany" Category="Surnames"/>		
	</NameDefinition>

</NameList>

The file actually consists of two parts…

Origin

In the first part, there are these “Origin” elements, which simply define lists of names. In the example, we have an Origin “Germany” and in this origin, three “Category”s (Female Firstnames, Male Firstnames and Surnames). The actual names are in the “Names” element, separated by commas. You can name your Origins and Categories whatever you want.

NameDefinition

In the 2nd part are the actual name definitions. These are rules how to combine various elements to form a name. In the example we have one such name definition, “German Female”.

This definitions consists of two “NameRef”s, which just points to one of the Categories defined above. In the example, it simply says: First, take a random name out of the Category “Female Firstnames” in the Origin “Germany” and then take a random name out of the Category “Surnames” in the Origin “Germany. So this definition will result in names with one of the Female Firstnames and one of the Surnames from the Origin Germany.

Of course, these are just the basics, there are ways to make it a little bit more complex…

FixedNamePart & automaticSpaces

Sometimes, you want to add a fixed part to your names, for example if you want to create Male members of the Johnson family. You could solve that by only entering “Johnson” as a Surname, but there's a better way to do this, the FixedName-Element. Consider the following example:

	<NameDefinition name="German Male">
		<FixedNamePart>Herr</FixedNamePart>
		<NameRef Origin="Germany" Category="Male Firstnames"/>		
		<FixedNamePart>Johnson</FixedNamePart>
	</NameDefinition>

In this example, “Herr” (meaning Mr.) will be the first thing, then a random german male first name and then “Johnson”.

In some cases, you also might want to control where to put spaces yourselves, for example when creating double-names. In this case, simple set the automaticSpaces attribute of the NameDefinition to false, like this:

	<NameDefinition name="German Female" automaticSpaces="false">
		<FixedNamePart>Frau </FixedNamePart>
		<NameRef Origin="Germany" Category="Female Firstnames"/>		
		<FixedNamePart> </FixedNamePart>
		<NameRef Origin="Germany" Category="Surnames"/>
		<FixedNamePart>-</FixedNamePart>
		<NameRef Origin="Germany" Category="Surnames"/>
	</NameDefinition>

By setting automaticSpaces=“false” you tell the program that you will handle the spaces yourself (otherwise, the program simply adds a space after each element). So, in the example you have to add the spaces after “Frau” and all the name parts manually (with FixedNamePart elements), but you gain the ability to create double name with a dash, for example “Bergen-Eichel”, without having the program adding spaces to it (as this would lead to “Bergen - Eichel”.

PercentChance

In some cases you want only a certain percent of people have a certain part of the name. For example, let's say we want 10% of our men have a 2nd name. Then you would write…

	<NameDefinition name="German Male">
		<NameRef Origin="Germany" Category="Male Firstnames"/>		
		<NameRef Origin="Germany" Category="Male Firstnames" percentChance="10"/>		
		<NameRef Origin="Germany" Category="Surnames"/>
	</NameDefinition>

And bingo, only in 10% of the cases, a 2nd first name will be added.

Combination

Imagine the example about the double-names. Now imagine, you only want to have 10% of the people to have double names. As the double name is attached by a slash, you will have to combine that somehow: Only add a slash if there's a double name. For this, you can use Combinations:

	<NameDefinition name="German Female" automaticSpaces="false">
		<FixedNamePart>Frau </FixedNamePart>
		<NameRef Origin="Germany" Category="Female Firstnames"/>		
		<FixedNamePart> </FixedNamePart>
		<NameRef Origin="Germany" Category="Surnames"/>
		<Combination percentChance="10">
			<FixedNamePart>-</FixedNamePart>
			<NameRef Origin="Germany" Category="Surnames"/>
		</Combination>
	</NameDefinition>

As you can see, this combination will only appear in 10% of all cases and when it does, it consists of one slash and a surname.

Choice

Sometimes you want not a combination of things, but one of a list of things. For this, there is the choice element. For example, we know that american people can have various names: English-sounding ones, german-sounding ones, etc. So when we want to create an american name, we have to choose one. Have a look at the following example (and imagine, that the apropriate Origins and Categories were there):

	<NameDefinition name="American Male">
		<Choice>
			<NameRef Origin="German" Category="Male Firstnames" percentChance="10"/>
			<NameRef Origin="Finland" Category="Male Firstnames" percentChance="10"/>
			<NameRef Origin="England" Category="Male Firstnames"/>
		</Choice>		
		<Choice>
			<NameRef Origin="German" Category="Male Surnames" percentChance="10"/>
			<NameRef Origin="Finland" Category="Male Surnames" percentChance="10"/>
			<NameRef Origin="England" Category="Male Surnames"/>
		</Choice>
	</NameDefinition>	

This example gives the name a 10% chance, that the firstname is german. If this doesn't apply, then there's a 10% chance that the name will be a finish one. And if that doesn't apply, it'll take an english one. Same thing with the surnames. The important point it to not give a percentChance for the last choice (or at least a 100% one), as otherwise you could end up with no name at all.

As you can see, the name generator files are quite powerfull and should be totally adequate to create not only European names, but also Asian, African and even fantasy names.