One-to-many relationships using XML as a datastore

E

eric

I am using an xml file as a relational data store like the following
(original data is much larger):

....
<variable>
<id>A</id>
<name>VarA</name>
<description></decription>
</variable>
<variable>
<id>B</id>
<name>VarB</name>
<description></decription>
</variable>
<variable>
<id>C</id>
<name>VarC</name>
<description></decription>
</variable>
<variable-group>
<id>Group1</id>
<variable>A</variable>
<variable>B</variable>
</variable-group>
<variable-group>
<id>Group2</id>
<variable>A</variable>
<variable>C</variable>
</variable-group>
<variable-group>
<id>Group3</id>
<variable>B</variable>
<variable>C</variable>
</variable-group>
<report>
<id>Report1</id>
<variable-group>Group1</variable-group>
<variable>A</variable>
<variable>B</variable>
</report>
<report>
<id>Report2</id>
<variable-group>Group2</variable-group>
<variable-group>Group3</variable-group>
</report>
....


I'm using VS.NET 2002 and the XML Designer to generate the appropriate
schema and dataset. I use the msdata:Relationship tags to specify the
relationships. However, when I call the GetChildRows method on the
dataset, I only get the first row returned. For instance, in the above
example, when I get the child rows for the 'variable-group'
relationship for 'group1', I get the variable 'A' row, that's it. When
I set maxOccurs="unbounded" for the 'variable' element within the
variable-group, VS.NET cannot compile/generate the underlying dataset.

I realize that the example above is a little vague but I have to
believe that this is a common problem. I have search for answers for a
few days now and nothing seems to work. Incidently, the XML Designer
in VS will not allow me to have the same element names within different
elements. I had to do some renaming to fix this as I was led to
believe that the scope was local to the hierachy of the elements.
Thinking object oriented here but I guess everything's global.


Thanks in advance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top