Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
|
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 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 2nd, 2004, 08:56 AM
Registered User
 
Join Date: Jun 2004
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>

 
Old June 2nd, 2004, 09:10 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,101
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
 
Old June 2nd, 2004, 09:24 AM
Registered User
 
Join Date: Jun 2004
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>


 
Old June 2nd, 2004, 09:39 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,101
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
 
Old June 2nd, 2004, 10:11 AM
Registered User
 
Join Date: Jun 2004
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?

 
Old June 2nd, 2004, 10:27 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,101
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
 
Old June 9th, 2004, 12:22 AM
Registered User
 
Join Date: Jun 2004
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









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





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