Hi,
I was using Typed Dataset in VB.NET to generate XML file.
I difined XSD file( named customer_order_info) to include three tables,
let's say customers, orders and order_details. I also defined relationship
between customers and orders, orders and order_details.( customerid is PK in
customers, orderid is PK in orders, orderid and productid are PK in
order_details).
In my VB.NET code, I declared a variable as the XSD(customer_order_info),
declared a adapter to populate it(some common routines to get dataset). the
select command is a stored procedure which will retuen 3 recordsets. I also
defined table mappings when I populated the dataset. After I got the dataset,
I call ds.getXML to get xml file. I was able to get the file with correct
content, but the format is wrong. For eample, the format should be as follows:
<customer customerid=â??aaaâ?? name=â??billâ?? phone=â??123345456â?? >
<order orderid=â??1011â?? customerid=â??aaaâ?? shipname=â??Du monde entireâ??>
<order_detail orderid=â??1011â?? productid=â??tool1â?? quantity=â??12â??/>
<order_detail orderid=â??1011â?? productid=â??tool2â?? quantity=â??20â??/>
<order_detail orderid=â??1011â?? productid=â??tool3â?? quantity=â??30â??/>
</order>
<order orderid=â??1012â?? customerid=â??aaaâ?? shipname=â??Du monde entireâ??>
<order_detail orderid=â??1012â?? productid=â??tool4â?? quantity=â??12â??/>
<order_detail orderid=â??1012â?? productid=â??tool2â?? quantity=â??20â??/>
<order_detail orderid=â??1012â?? productid=â??tool5â?? quantity=â??30â??/>
</order>
</customer>

But I got :
<customer customerid=â??aaaâ?? name=â??billâ?? phone=â??123345456â?? >
<order orderid=â??1011â?? customerid=â??aaaâ?? shipname=â??Du monde entireâ??/>
<order orderid=â??1012â?? customerid=â??aaaâ?? shipname=â??Du monde entireâ??/>
<order_detail orderid=â??1011â?? productid=â??tool1â?? quantity=â??12â??/>
<order_detail orderid=â??1011â?? productid=â??tool2â?? quantity=â??20â??/>
<order_detail orderid=â??1011â?? productid=â??tool3â?? quantity=â??30â??/>
<order_detail orderid=â??1012â?? productid=â??tool4â?? quantity=â??12â??/>
<order_detail orderid=â??1012â?? productid=â??tool2â?? quantity=â??20â??/>
<order_detail orderid=â??1012â?? productid=â??tool5â?? quantity=â??30â??/>
</customer>

Could anyone help me out?
Thanks.

Re: Get XML from typed dataset by Kawarjit

Kawarjit
Mon Dec 06 00:27:34 CST 2004

The generated XML indicates that the relation between DataTable order and
order_detail is not nested. Set the Nested property on the corresponding
DataRelation to true. ( Note: The relation between Customer and order is
Nested)

Thanks,
Kawarjit Bedi

Program Manager - ADO.NET Team
Microsoft Corp.

This posting is provided "AS IS" with no warranties, and confers no rights.


"william" <william@discussions.microsoft.com> wrote in message
news:4CA791AB-5A9B-459B-B696-A1F3F8440B9A@microsoft.com...
> Hi,
> I was using Typed Dataset in VB.NET to generate XML file.
> I difined XSD file( named customer_order_info) to include three tables,
> let's say customers, orders and order_details. I also defined relationship
> between customers and orders, orders and order_details.( customerid is PK
in
> customers, orderid is PK in orders, orderid and productid are PK in
> order_details).
> In my VB.NET code, I declared a variable as the XSD(customer_order_info),
> declared a adapter to populate it(some common routines to get dataset).
the
> select command is a stored procedure which will retuen 3 recordsets. I
also
> defined table mappings when I populated the dataset. After I got the
dataset,
> I call ds.getXML to get xml file. I was able to get the file with correct
> content, but the format is wrong. For eample, the format should be as
follows:
> <customer customerid="aaa" name="bill" phone="123345456" >
> <order orderid="1011" customerid="aaa" shipname="Du monde entire">
> <order_detail orderid="1011" productid="tool1" quantity="12"/>
> <order_detail orderid="1011" productid="tool2" quantity="20"/>
> <order_detail orderid="1011" productid="tool3" quantity="30"/>
> </order>
> <order orderid="1012" customerid="aaa" shipname="Du monde entire">
> <order_detail orderid="1012" productid="tool4" quantity="12"/>
> <order_detail orderid="1012" productid="tool2" quantity="20"/>
> <order_detail orderid="1012" productid="tool5" quantity="30"/>
> </order>
> </customer>
>
> But I got :
> <customer customerid="aaa" name="bill" phone="123345456" >
> <order orderid="1011" customerid="aaa" shipname="Du monde entire"/>
> <order orderid="1012" customerid="aaa" shipname="Du monde entire"/>
> <order_detail orderid="1011" productid="tool1" quantity="12"/>
> <order_detail orderid="1011" productid="tool2" quantity="20"/>
> <order_detail orderid="1011" productid="tool3" quantity="30"/>
> <order_detail orderid="1012" productid="tool4" quantity="12"/>
> <order_detail orderid="1012" productid="tool2" quantity="20"/>
> <order_detail orderid="1012" productid="tool5" quantity="30"/>
> </customer>
>
> Could anyone help me out?
> Thanks.
>



Re: Get XML from typed dataset by Sahil

Sahil
Mon Dec 06 00:42:14 CST 2004

Set the Nested Property of the appropriat DataRelation to "True". That
should give you nested XML.

- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik


"william" <william@discussions.microsoft.com> wrote in message
news:4CA791AB-5A9B-459B-B696-A1F3F8440B9A@microsoft.com...
> Hi,
> I was using Typed Dataset in VB.NET to generate XML file.
> I difined XSD file( named customer_order_info) to include three tables,
> let's say customers, orders and order_details. I also defined relationship
> between customers and orders, orders and order_details.( customerid is PK
> in
> customers, orderid is PK in orders, orderid and productid are PK in
> order_details).
> In my VB.NET code, I declared a variable as the XSD(customer_order_info),
> declared a adapter to populate it(some common routines to get dataset).
> the
> select command is a stored procedure which will retuen 3 recordsets. I
> also
> defined table mappings when I populated the dataset. After I got the
> dataset,
> I call ds.getXML to get xml file. I was able to get the file with correct
> content, but the format is wrong. For eample, the format should be as
> follows:
> <customer customerid="aaa" name="bill" phone="123345456" >
> <order orderid="1011" customerid="aaa" shipname="Du monde entire">
> <order_detail orderid="1011" productid="tool1" quantity="12"/>
> <order_detail orderid="1011" productid="tool2" quantity="20"/>
> <order_detail orderid="1011" productid="tool3" quantity="30"/>
> </order>
> <order orderid="1012" customerid="aaa" shipname="Du monde entire">
> <order_detail orderid="1012" productid="tool4" quantity="12"/>
> <order_detail orderid="1012" productid="tool2" quantity="20"/>
> <order_detail orderid="1012" productid="tool5" quantity="30"/>
> </order>
> </customer>
>
> But I got :
> <customer customerid="aaa" name="bill" phone="123345456" >
> <order orderid="1011" customerid="aaa" shipname="Du monde entire"/>
> <order orderid="1012" customerid="aaa" shipname="Du monde entire"/>
> <order_detail orderid="1011" productid="tool1" quantity="12"/>
> <order_detail orderid="1011" productid="tool2" quantity="20"/>
> <order_detail orderid="1011" productid="tool3" quantity="30"/>
> <order_detail orderid="1012" productid="tool4" quantity="12"/>
> <order_detail orderid="1012" productid="tool2" quantity="20"/>
> <order_detail orderid="1012" productid="tool5" quantity="30"/>
> </customer>
>
> Could anyone help me out?
> Thanks.
>



Re: Get XML from typed dataset by william

william
Mon Dec 06 19:59:01 CST 2004

It works.
Thanks


"Sahil Malik" wrote:

> Set the Nested Property of the appropriat DataRelation to "True". That
> should give you nested XML.
>
> - Sahil Malik
> http://dotnetjunkies.com/weblog/sahilmalik
>
>
> "william" <william@discussions.microsoft.com> wrote in message
> news:4CA791AB-5A9B-459B-B696-A1F3F8440B9A@microsoft.com...
> > Hi,
> > I was using Typed Dataset in VB.NET to generate XML file.
> > I difined XSD file( named customer_order_info) to include three tables,
> > let's say customers, orders and order_details. I also defined relationship
> > between customers and orders, orders and order_details.( customerid is PK
> > in
> > customers, orderid is PK in orders, orderid and productid are PK in
> > order_details).
> > In my VB.NET code, I declared a variable as the XSD(customer_order_info),
> > declared a adapter to populate it(some common routines to get dataset).
> > the
> > select command is a stored procedure which will retuen 3 recordsets. I
> > also
> > defined table mappings when I populated the dataset. After I got the
> > dataset,
> > I call ds.getXML to get xml file. I was able to get the file with correct
> > content, but the format is wrong. For eample, the format should be as
> > follows:
> > <customer customerid="aaa" name="bill" phone="123345456" >
> > <order orderid="1011" customerid="aaa" shipname="Du monde entire">
> > <order_detail orderid="1011" productid="tool1" quantity="12"/>
> > <order_detail orderid="1011" productid="tool2" quantity="20"/>
> > <order_detail orderid="1011" productid="tool3" quantity="30"/>
> > </order>
> > <order orderid="1012" customerid="aaa" shipname="Du monde entire">
> > <order_detail orderid="1012" productid="tool4" quantity="12"/>
> > <order_detail orderid="1012" productid="tool2" quantity="20"/>
> > <order_detail orderid="1012" productid="tool5" quantity="30"/>
> > </order>
> > </customer>
> >
> > But I got :
> > <customer customerid="aaa" name="bill" phone="123345456" >
> > <order orderid="1011" customerid="aaa" shipname="Du monde entire"/>
> > <order orderid="1012" customerid="aaa" shipname="Du monde entire"/>
> > <order_detail orderid="1011" productid="tool1" quantity="12"/>
> > <order_detail orderid="1011" productid="tool2" quantity="20"/>
> > <order_detail orderid="1011" productid="tool3" quantity="30"/>
> > <order_detail orderid="1012" productid="tool4" quantity="12"/>
> > <order_detail orderid="1012" productid="tool2" quantity="20"/>
> > <order_detail orderid="1012" productid="tool5" quantity="30"/>
> > </customer>
> >
> > Could anyone help me out?
> > Thanks.
> >
>
>
>