Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
XML
data.xmlanalysis
mappoint.webservice
msf
msxml-webrelease
netmyservices.sdk
passport.sdk
soap
soapsdk
uddi.general
uddi.programming
uddi.specification
xml
xmlsqlwebrelease
xsl
  
 
date: Thu, 12 Jun 2008 03:19:35 -0700 (PDT),    group: microsoft.public.xml        back       


How to build hierarchical XML from DataSet   
Hi!

I need to build the following XML structure in my businnesslayer in
VB.NET.

<ProductionDataExtract>
  <Region region="South">
    <MonthToDate>
      <ProductionBudget>2338</ProductionBudget>
    </MonthToDate>
  </Region>
</ProductionDataExtract>

My problem is that when i use DataSet.getXML() i will get a flat file
structure on the xml returned.

What I want is the following:
<ProductionDataExtract> (Root node, parent)
<Region> (child node of ProductionDataExtract, but parent to
MonthToDate)
<MonthToDate> (child node of Region, but parent to ProductionBudget)
<ProductionBudget> (child node of MonthToDate)

I have tried using ADO.NET's DataRelation Object, but of course this
wont work as I have no Key's between the parent and child elements.

So any suggestion are really appreciated! :)

Regards,
Mcad
date: Thu, 12 Jun 2008 03:19:35 -0700 (PDT)   author:   unknown

Re: How to build hierarchical XML from DataSet   
gamesforums@hotmail.com wrote:

> I need to build the following XML structure in my businnesslayer in
> VB.NET.
> 
> <ProductionDataExtract>
>   <Region region="South">
>     <MonthToDate>
>       <ProductionBudget>2338</ProductionBudget>
>     </MonthToDate>
>   </Region>
> </ProductionDataExtract>
> 
> My problem is that when i use DataSet.getXML() i will get a flat file
> structure on the xml returned.

Then don't use a DataSet but use XmlWriter or XmlDocument to create the 
XML as needed. Or if you need to use the DataSet one way to get the 
required result is to write an XSLT stylesheet that transforms the XML 
as needed.


-- 

	Martin Honnen --- MVP XML
	http://JavaScript.FAQTs.com/
date: Thu, 12 Jun 2008 13:22:39 +0200   author:   Martin Honnen

Re: How to build hierarchical XML from DataSet   
On Jun 12, 1:22 pm, Martin Honnen  wrote:
> gamesfor...@hotmail.com wrote:
> > I need to build the following XML structure in my businnesslayer in
> > VB.NET.
>
> > <ProductionDataExtract>
> >   <Region region="South">
> >     <MonthToDate>
> >       <ProductionBudget>2338</ProductionBudget>
> >     </MonthToDate>
> >   </Region>
> > </ProductionDataExtract>
>
> > My problem is that when i use DataSet.getXML() i will get a flat file
> > structure on the xml returned.
>
> Then don't use a DataSet but use XmlWriter or XmlDocument to create the
> XML as needed. Or if you need to use the DataSet one way to get the
> required result is to write an XSLT stylesheet that transforms the XML
> as needed.
>
> --
>
>         Martin Honnen --- MVP XML
>        http://JavaScript.FAQTs.com/
Thanx!

Hm, ok so i will need a step in between....
Right now I have a method that calls my DB and gets the records
returned into a DataSet. Then I want to take that dataset and create
the XML as I described.

What I dont understand is how the XmlWriter can be able to read from
the DataSet and then explicitly defined that <ProductionDataExtract>
is going to be the root node and <Region> will be a child node
underneath etc...That is possible to define with the XmlWriter?
date: Thu, 12 Jun 2008 04:56:54 -0700 (PDT)   author:   unknown

Re: How to build hierarchical XML from DataSet   
gamesforums@hotmail.com wrote:

> What I dont understand is how the XmlWriter can be able to read from
> the DataSet and then explicitly defined that <ProductionDataExtract>
> is going to be the root node and <Region> will be a child node
> underneath etc...That is possible to define with the XmlWriter?

No, when I pointed you to XmlWriter it was meant as an alternative to 
DataSet and WriteXml. If you use a DataSet and WriteXml then you will 
have to live with the XML it produces although you can specify some 
variances using a schema with the DataSet.

-- 

	Martin Honnen --- MVP XML
	http://JavaScript.FAQTs.com/
date: Thu, 12 Jun 2008 14:32:55 +0200   author:   Martin Honnen

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us