Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XML
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 2nd, 2004, 08:56 AM
Registered User
 
Join Date: Jun 2004
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default XML output

I am using vb.net and i want to create an xml file with an output similar to this: (the information in red comes from a table in SQLServer2000)
<partinformation>
  <header>
    <extractversion>1.1.2</extractversion>
    <Parentinformation>
        <Duns>12346</Duns>
        <Location>01</Location>
    </Parentinformation>
    <ManufacturerInformation>
      <Duns>54646</Duns>
      <Location>01</Location>
    </ManufacturerInformation>
  </header>
</partinformation>

Reply With Quote
  #2 (permalink)  
Old June 2nd, 2004, 09:10 AM
Friend of Wrox
Points: 3,489, Level: 24
Points: 3,489, Level: 24 Points: 3,489, Level: 24 Points: 3,489, Level: 24
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Central, NJ, USA.
Posts: 1,102
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Ok- is there a question in there somewhere?


Hal Levy
Web Developer, PDI Inc.

NOT a Wiley/Wrox Employee
Reply With Quote
  #3 (permalink)  
Old June 2nd, 2004, 09:24 AM
Registered User
 
Join Date: Jun 2004
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am using vb.net and i want to create an xml file with an output similar to this: (the information in red comes from a table in SQLServer2000) How do i do this?
<partinformation>
  <header>
    <extractversion>1.1.2</extractversion>
    <Parentinformation>
        <Duns>12346</Duns>
        <Location>01</Location>
    </Parentinformation>
    <ManufacturerInformation>
      <Duns>54646</Duns>
      <Location>01</Location>
    </ManufacturerInformation>
  </header>
</partinformation>


Reply With Quote
  #4 (permalink)  
Old June 2nd, 2004, 09:39 AM
Friend of Wrox
Points: 3,489, Level: 24
Points: 3,489, Level: 24 Points: 3,489, Level: 24 Points: 3,489, Level: 24
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Central, NJ, USA.
Posts: 1,102
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Ok- well, you open a file you write out the data and then you close the file.

I'm not going to write the routine for you- so if you have some specific questions, I'll be happy to answer what I can.


Hal Levy
Web Developer, PDI Inc.

NOT a Wiley/Wrox Employee
Reply With Quote
  #5 (permalink)  
Old June 2nd, 2004, 10:11 AM
Registered User
 
Join Date: Jun 2004
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

My table consists of the fields "ParentDuns", "ParentLocation", "ManufacturerDuns" & "ManufacturerLocation", so if were to write a sql with the keywords "FOR XML AUTO" or "FOR XML AUTO, ELEMENTS" i do not get the required output format. Do i am thinking that i need to modify the output of my sql, but i don't know how? I know how to read the data from a table in vb.net, but how i read the data from the table and write it out in the xml format given below?

Reply With Quote
  #6 (permalink)  
Old June 2nd, 2004, 10:27 AM
Friend of Wrox
Points: 3,489, Level: 24
Points: 3,489, Level: 24 Points: 3,489, Level: 24 Points: 3,489, Level: 24
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Central, NJ, USA.
Posts: 1,102
Thanks: 0
Thanked 2 Times in 2 Posts
Default

You can't. SQL outputs it in the form it has specified and you can't really change it- as far as I know.. You would need to ask in the SQL forum.

I'd read the data into a dataset and then write out the file in the format I want.
You can also use XSLT to convert the XML out of SQL to the format you want..

That said, since I am no XML or XSL expert, I'd write a program.


Hal Levy
Web Developer, PDI Inc.

NOT a Wiley/Wrox Employee
Reply With Quote
  #7 (permalink)  
Old June 9th, 2004, 12:22 AM
Registered User
 
Join Date: Jun 2004
Location: pune, MH, India.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by prashantnair
 My table consists of the fields "ParentDuns", "ParentLocation", "ManufacturerDuns" & "ManufacturerLocation", so if were to write a sql with the keywords "FOR XML AUTO" or "FOR XML AUTO, ELEMENTS" i do not get the required output format. Do i am thinking that i need to modify the output of my sql, but i don't know how? I know how to read the data from a table in vb.net, but how i read the data from the table and write it out in the xml format given below?

hi friend,
I thought you might get the partial solution to your problem
I dataset of Vb.NET there is method of save in which u specify
the XML as its output but the XML generated in which it gives the
complete listing the of fields and associated attribute as well
as the data you are desire as the requirement is of fields name
should be of same name as like the element name
i have tried in VB with ADO 2.8, the recordset method save in which u have
to specify persistformat

<partinformation>
  <header>
    <extractversion>1.1.2</extractversion>
    <Parentinformation>
        <Duns>12346</Duns>
        <Location>01</Location>
    </Parentinformation>
    <ManufacturerInformation>
      <Duns>54646</Duns>
      <Location>01</Location>
    </ManufacturerInformation>
  </header>
</partinformation>

Thanks

Sunil




Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to see xml output in IE? anboss XSLT 1 August 29th, 2008 05:16 PM
XML final output sanek55555 XSLT 8 November 2nd, 2006 04:12 AM
XML Output file Neal Crystal Reports 0 October 24th, 2006 07:02 AM
XML Output from stored procedure NigelBronson ASP.NET 2.0 Basics 0 October 15th, 2006 06:24 PM
Output XML Hadware .NET Framework 1.x 0 December 28th, 2005 09:55 PM



All times are GMT -4. The time now is 02:52 PM.


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