Re: Saving dataset as nested XML
From: Paul Eden (a_at_b.com)
Date: 10/05/04
- Next message: Marius Trælnes: "Re: System.xml in IE"
- Previous message: Martin Honnen: "Re: Check Constraints"
- In reply to: Richard L Rosenheim: "Re: Saving dataset as nested XML"
- Next in thread: Paul [Paradise Solutions]: "Re: Saving dataset as nested XML"
- Reply: Paul [Paradise Solutions]: "Re: Saving dataset as nested XML"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 05 Oct 2004 12:34:34 GMT
Essentially, the schema creates 2 relations (in my case)
Customers.Customer_ID --> Addresses.Customer_ID
and
Addresses.Addresses_ID --> Address.Addresses_ID
The following code created my output as nested:
With CustomerData
.ReadXmlSchema(IO.Path.GetDirectoryName(Application.ExecutablePath) &
"\Customer.xsd")
.Relations.Clear()
.Relations.Add("CustomerToAddresses",
.Tables(0).Columns("CustomerID"), .Tables(1).Columns("CustomerID"))
.Relations(0).Nested = True
.Relations.Add("AddressesToAddress",
.Tables(1).Columns("AddressesID"), .Tables(2).Columns("AddressesID"))
.Relations(1).Nested = True
End With
Where CustomerID and AddressesID are my new additional fields.
I also tried re-creating the relationships using the original fieldnames
(with the '_', which are hidden fields) but once again my output was wrong.
The code should paste driect into IDE without problems.
Paul
Richard L Rosenheim wrote:
> Can you please provide more details of how you got it to work?
>
> I too have confirmed that the relationships are being created by checking
> the Relations. My child tables, in additional to an unique autonumber ID
> field, also contains an ID field containing the parent ID. All these fields
> are defined as of type "long". And, IsNested is defined as true in the
> relation tags in the resulting XML Schema.
>
> Richard Rosenheim
>
>
> "Paul Eden" <a@b.com> wrote in message
> news:Xzg8d.202$y%3.31@newsfe1-win.ntli.net...
>
>>Richard
>>
>>I been fidling with this for most of the day. My Schema, when loaded
>>into the dataset, generates all the relevent relationships (this I did
>>not realise, going on the lack of correct output), with nested set to
>>true (via interogating the dataset).
>>I finally too the step of clearing the Relations collection on the data
>>set, and re-creating them manually (which was a bit of a bugger,
>>becausae I had to go through and add ID fields for the relationships)...
>>BUT.. my ouput is now nested.
>>
>>A long winded and painfull fix, but it's the only one I found - hope an
>>MS bod is reading - would be interesting to hear thier side.
>>
>>
>>Paul
>>
>>Richard L Rosenheim wrote:
>>
>>>You are correct -- having IsNested="true" doesn't seems to make any
>>>difference what-so-ever. In the XML file that I attached to my previous
>>>post, it contained IsNested="true" attributes for the keys.
>>>
>>>Richard Rosenheim
>>>
>>>
>>>
>>>"Paul Eden" <a@b.com> wrote in message
>>>news:0Rb8d.56$hs3.38@newsfe5-win.ntli.net...
>>>
>>>
>>>>Richard
>>>>
>>>>I'm having much the same issue. In one post I read that you have to set
>>>>up the relationships in the dataset and have the relationship flaged as
>>>>Nested=True, but this did not create the desired output either..
>>>>actually, it made no difference whatsoever. It might make a difference
>>>>for you?
>>>>
>>>>I can post my schema and code if required.
>>>>
>>>>
>>>>Paul
>>>>
>>>>Richard L Rosenheim wrote:
>>>>
>>>>
>>>>>I've been trying to save a dataset to a XML file and have the child
>
> data
>
>>>>>nested under the parent data. Everything I have tried so far results
>
> in
>
>>>all
>>>
>>>
>>>>>the records from the parent table being listed followed by all the rows
>>>
>>>of
>>>
>>>
>>>>>the child table.
>>>>>
>>>>>As a result of previous posts, I currently created my tables based upon
>>>
>>>the
>>>
>>>
>>>>>steps outlined in
>>>>>
>>>
>>>
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbtskcreatingnestedrelationshipsinxmlschemas.asp
>
>>>>>For my example, I created three tables: Contacts, Telephones and
>>>
>>>Addresses
>>>
>>>
>>>>>where Telephones and Addresses are defined as children of Contacts. In
>>>
>>>the
>>>
>>>
>>>>>resulting schema, Telephones and Addresses are nested within Contacts.
>>>
>>>But
>>>
>>>
>>>>>the actual data is not.
>>>>>
>>>>>What I'm looking to achieve is to have the data outputted in a format
>>>
>>>like:
>>>
>>>
>>>>> <Contacts>
>>>>> <Addresses>
>>>>> </Addresses>
>>>>> <Telephones>
>>>>> </Telephones>
>>>>> <Telephones>
>>>>> </Telephones>
>>>>> </Contacts>
>>>>>instead of the structure I'm getting:
>>>>> <Contacts>
>>>>> </Contacts>
>>>>> <Contacts>
>>>>> </Contacts>
>>>>> <Addresses>
>>>>> </Addresses>
>>>>> <Telephones>
>>>>> </Telephones>
>>>>> <Telephones>
>>>>> </Telephones>
>>>>>
>>>>>Anyone have any ideas? Attached is the resulting XML file I'm getting,
>>>
>>>with
>>>
>>>
>>>>>schema. I'm using Visual Studio 2003.
>>>>>
>>>>>TIA,
>>>>>
>>>>>Richard Rosenheim
>>>>>
>>>>>
>>>
>>>
>>>
>
>
- Next message: Marius Trælnes: "Re: System.xml in IE"
- Previous message: Martin Honnen: "Re: Check Constraints"
- In reply to: Richard L Rosenheim: "Re: Saving dataset as nested XML"
- Next in thread: Paul [Paradise Solutions]: "Re: Saving dataset as nested XML"
- Reply: Paul [Paradise Solutions]: "Re: Saving dataset as nested XML"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|