I have some xml data contained in three files (Database.xml, Participants.xml, and ConditionTokens.xml). I am trying to use external entities to place the participants and condition tokens into the database file, but when I run this code...
string xmlPath = Environment.CurrentDirectory + @"\Data\Database.xml";
XElement database = XElement.Load(xmlPath);
...there are no participants or condition tokens in my xml (the HasElements property for "database" is false). There should be two child elements. I get no errors/warnings within Visual Studio (2008), and the live schema validation seems to be happy, but something is not quite right when I run my code.
Could anyone tell me what I'm doing wrong?
I have pasted the three xml files below.
Thanks very much!
-Dan
Database.xml
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE database [
<!ENTITY conditionTokens SYSTEM "ConditionTokens.xml">
<!ENTITY participants SYSTEM "Participants.xml">]>
<database
xmlns="experimentManager"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="experimentManager Database.xsd">
&conditionTokens;
&participants;
</database>
ConditionTokens.xml
<?xml version="1.0" encoding="utf-8" ?>
<conditionTokens>
<conditionToken>
<id>1</id>
<token>LargeToSmall</token>
</conditionToken>
<conditionToken>
<id>2</id>
<token>SmallToLarge</token>
</conditionToken>
</conditionTokens>
Participants.xml
<?xml version="1.0" encoding="utf-8" ?>
<participants>
<participant>
<id>1</id>
<conditionTokenId>1</conditionTokenId>
</participant>
<participant>
<id>2</id>
<conditionTokenId>2</conditionTokenId>
</participant>
</participants>