elements within elements in xsd (I think)

  • Thread starter Thread starter jake
  • Start date Start date
J

jake

Can someone please give me the xsd schema lines that can produce xml
such as the following:

<accounts>
<account>
<number>10135</number>
<name>john doe's checking account</name>
<transaction>
<debit>ATM</debit>
<amount>200</amount>
</transaction>
<transaction>
<debit>check</debit>
<amount>100</amount>
</transaction>
<transaction>
<debit>ATM</debit>
<amount>60</amount>
</transaction>
...
</account>
<account>
<number>106932</number>
<name>jane doe's investment account</name>
<transaction>
<credit>overnight deposit</credit>
<amount>1500</amount>
</transaction>
...and so on
</account>
...
</accounts>

I can take the easy way out and treat "transactions" as a separate
table, so to speak, and then link it to "accounts" table by some key
say, account number. But, the resulting xml will not look like the
above.

So, how can I do it so that "transactions" becomes a collection of rows
that belong to a row in "accounts"

The example in MSDN is too complicated. xsd designer is no help either.
 
Thank you very much Peter. I did not know about xsd.exe. I ran it
against the sample xml file that I listed here earlier and it worked.
At least, I trust that what it created is good.

Since I posted my first message, I spent a couple of hours fiddling
with the xml (xsd) visual designer and I finally got the design to be
very simple and plain vanilla. It is supposed to be exactly what I
wanted, according to .net help screens. The resulting xsd file is more
complicated than the one created using xsd.exe.

Makes me wonder.

Anyway, thank you again. That helped a great deal.
 

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

Back
Top