Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. DataSet to XMLDataDocument - change tag names

DataSet to XMLDataDocument - change tag names

Scheduled Pinned Locked Moved Database
xmlquestiondatabase
3 Posts 2 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MS le Roux
    wrote on last edited by
    #1

    When I convert my DataSet to an XMLDataDocument, the XML result looks something like this:

    <NewDataSet>
    <Table>
    <ID>123</ID>
    <Name>Bob</Name>
    </Table>
    </NewDataSet>

    How do I specify what the tagnames should be of the root and row elements? I would like my result to be something like this:

    <Employees>
    <Employee>
    <ID>123</ID>
    <Name>Bob</Name>
    </Employee>
    </Employees>

    Is the only way to do this by first reading an XML schema into the DataSet? If so, is there a way to write the schema in such a way that only the root and row elements are renamed, but the column elements are processed as is?

    B 1 Reply Last reply
    0
    • M MS le Roux

      When I convert my DataSet to an XMLDataDocument, the XML result looks something like this:

      <NewDataSet>
      <Table>
      <ID>123</ID>
      <Name>Bob</Name>
      </Table>
      </NewDataSet>

      How do I specify what the tagnames should be of the root and row elements? I would like my result to be something like this:

      <Employees>
      <Employee>
      <ID>123</ID>
      <Name>Bob</Name>
      </Employee>
      </Employees>

      Is the only way to do this by first reading an XML schema into the DataSet? If so, is there a way to write the schema in such a way that only the root and row elements are renamed, but the column elements are processed as is?

      B Offline
      B Offline
      Bruce Duncan
      wrote on last edited by
      #2

      I'm just hazarding a guess here, but couldn't you set the DataSetName and DataTableName properties of your data structure/object. some semi-pseudocode

      dsEmployees.DataSetName = "Employees"
      dsEmployees.Tables[0].DataTableName = "Employee"

      Or I could be spouting a load of bull :-) Bruce Duncan CP#9088, CPUA 0xA1EE, Sonork 100.10030
      Hi everyone. My name's Bruce. And I suffer from VB.

      M 1 Reply Last reply
      0
      • B Bruce Duncan

        I'm just hazarding a guess here, but couldn't you set the DataSetName and DataTableName properties of your data structure/object. some semi-pseudocode

        dsEmployees.DataSetName = "Employees"
        dsEmployees.Tables[0].DataTableName = "Employee"

        Or I could be spouting a load of bull :-) Bruce Duncan CP#9088, CPUA 0xA1EE, Sonork 100.10030
        Hi everyone. My name's Bruce. And I suffer from VB.

        M Offline
        M Offline
        MS le Roux
        wrote on last edited by
        #3

        It works :) (except that it's TableName instead of DataTableName). Thanks!

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups