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
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/
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?
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/