Hi all,
I'm trying to create a simple XML structure for storing tree-stryle data for
a forum-like software, e.g. each post will have a body field, the ID of the
user who posted the message, and zero or more subposts(replies). Thus it
would allow for unlimited depth of subposts.
I also need a simple table to store UserID, Full Name, etc of the users
posting messages.
I've created a schema in VS.NET 2003 as follows. However, now I need to add
a relation between ID field of User table and UserID field of Post table
(one-to-many). If I try to add such relation, I get "Failed to add data
relation. Exception has been thrown by the target of an invocation."
Any help is greatly appreciated.
----------------------
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="DsPost" targetNamespace="http://tempuri.org/DsPost.xsd"
elementFormDefault="qualified"
attributeFormDefault="qualified" xmlns="http://tempuri.org/DsPost.xsd"
xmlns:mstns="http://tempuri.org/DsPost.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="DsPost" msdata:IsDataSet="true">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="Post">
<xs:complexType>
<xs:sequence>
<xs:element name="Body" type="xs:string" minOccurs="0" />
<xs:element name="UserID" type="xs:int" minOccurs="0" />
<xs:element name="Post" type="PostType" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="User">
<xs:complexType>
<xs:sequence>
<xs:element name="ID" type="xs:int" minOccurs="0" />
<xs:element name="Name" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:key name="DsPostKey1" msdata:PrimaryKey="true">
<xs:selector xpath=".//mstns:User" />
<xs:field xpath="mstns:ID" />
</xs:key>
</xs:element>
<xs:complexType name="PostType">
<xs:sequence>
<xs:element name="Body" type="xs:string" minOccurs="0" />
<xs:element name="UserID" type="xs:int" minOccurs="0" />
<xs:element name="Post" type="PostType" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:schema>