Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB.NET
|
VB.NET General VB.NET discussions for issues that don't fall into other VB.NET forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 13th, 2003, 01:31 PM
Registered User
 
Join Date: Jun 2003
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default XML file w ith parent / child relationship

Hi all,

I want to create an xml file that will be based on the same structure as my sql database which consists of 4 tables. Here are the 4 tables and the columns within each table:

Code:
BrochureHeader
  Columns
    BrochureID
    BrochureName

BrochureMerchant
  Columns
    BrochureID
    MerchantRow

BrochureSpot
  Columns
    BrochureID
    MerchantRow
    SpotNum

BrochureLine
  Columns
    BrochureID
    MerchantID
    SpotNum
    LineNum
    CopyText

I want my XML File to appear as follows:
<Level1>
  <BrochureName>ABC School</BrochureName>
   <Level2>
    <MerchantRow>1</MerchantRow>
      <Level3>
        <SpotNum>1</SpotNum>
         <Level4>
           <CopyText>Some Text</CopyText>
           <CopyText>Some Text</CopyText>
           <CopyText>Some Text</CopyText>
           <CopyText>Some Text</CopyText>
         </Level4>
      </Level3>
      <Level3>
        <SpotNum>2</SpotNum>
         <Level4>
           <CopyText>Some Text</CopyText>
           <CopyText>Some Text</CopyText>
           <CopyText>Some Text</CopyText>
           <CopyText>Some Text</CopyText>
         </Level4>
      </Level3>
   </Level2>
   <Level2>
    <MerchantRow>2</MerchantRow>
      <Level3>
        <SpotNum>1</SpotNum>
         <Level4>
           <CopyText>Some Text</CopyText>
           <CopyText>Some Text</CopyText>
           <CopyText>Some Text</CopyText>
           <CopyText>Some Text</CopyText>
         </Level4>
      </Level3>
      <Level3>
        <SpotNum>2</SpotNum>
         <Level4>
           <CopyText>Some Text</CopyText>
           <CopyText>Some Text</CopyText>
           <CopyText>Some Text</CopyText>
           <CopyText>Some Text</CopyText>
         </Level4>
      </Level3>
   </Level2>
</Level1>
I am having a terrible time getting this to work. I hate to post my code at this point because it doesn't work. I creating a dataset for each of my tables and I have messed around with the datarelation class but I have not had much luck. DOes anyone know of a web site that creates an XML file with similar hiearchy or does anyone have some code they can share?

Thanks,
Bob
 
Old June 13th, 2003, 05:21 PM
Authorized User
 
Join Date: Jun 2003
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
Default

If you are using Visual Studio .net you can quite easily create a typed Dataset that will reveal an XML schema that you can use to produce XMl that reflects the rules of the database.

Its quite easy to get an XML representation of a dataset, so why dont you just write code that produces a dataset then persist it to XML and see what it looks like?

Quote:
quote:Originally posted by bh0526

I want to create an xml file that will be based on the same structure as my sql database which consists of 4 tables. Here are the 4 tables and the columns within each table:
 
Old June 16th, 2003, 09:00 AM
Registered User
 
Join Date: Jun 2003
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the response but basically you didn't really provide me with anything that will help me. I am creating a dataset already but I want to create a dataset in such a way that when I write it out to XML it will look like my example. I do not know how to create a dataset that will produce the xml in my original post. ANy help would be appreciated.

Thanks,
Bob
 
Old June 18th, 2003, 08:28 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,101
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Bob,

I wonder- did you output the XML representation of the dataset as suggested? What does that look like?

Hal Levy
Daddyshome, LLC
NOT a Wiley/Wrox Employee





Similar Threads
Thread Thread Starter Forum Replies Last Post
parent child relationship in far point grid amitnigam Assembly Language 1 January 5th, 2012 10:43 PM
How can I display parent & child nodes if XML .... vishnu108mishra ASP.NET 2.0 Basics 0 November 17th, 2007 07:45 AM
SP for parent/child relationship Steven SQL Server 2000 0 September 26th, 2005 01:37 AM
Parent - Child Combo babloo81 JSP Basics 0 April 27th, 2005 01:46 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.