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. General Programming
  3. C#
  4. working with xml

working with xml

Scheduled Pinned Locked Moved C#
databasetutorialcsharpsql-serversysadmin
4 Posts 2 Posters 0 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.
  • S Offline
    S Offline
    sc steinhayse
    wrote on last edited by
    #1

    In a C# 2010 desktop/console appplication, I would to know how to accomplish my tasks (or at least part of my taks) listed below working with xml: 1. I want to parse out specific nodes so that I can access the various level of nodes I am working with. 2. I would like to place various data elements in a collection/array that I can work with like an array. 3. I would like to take the xml file and add certain sections to a sql server 2008 r2 database. **Note: The xml contains the various kind of stuctures: a. There is an occurence of 0 to 50 customer names. b. There is a node is just unique elements. c. There is an occurences of 0 to 25 elements that contain the following 4 items in each occurence: customer number, customber address, customer city state and zip, contact name, contact number. Thus can you tell me and/or point to to references that will show me how to accomplish my goals (or at least part of the goals)? If I have at least an example or two to look at, I can figure out how to accomplish the rest of the goals.

    P 1 Reply Last reply
    0
    • S sc steinhayse

      In a C# 2010 desktop/console appplication, I would to know how to accomplish my tasks (or at least part of my taks) listed below working with xml: 1. I want to parse out specific nodes so that I can access the various level of nodes I am working with. 2. I would like to place various data elements in a collection/array that I can work with like an array. 3. I would like to take the xml file and add certain sections to a sql server 2008 r2 database. **Note: The xml contains the various kind of stuctures: a. There is an occurence of 0 to 50 customer names. b. There is a node is just unique elements. c. There is an occurences of 0 to 25 elements that contain the following 4 items in each occurence: customer number, customber address, customer city state and zip, contact name, contact number. Thus can you tell me and/or point to to references that will show me how to accomplish my goals (or at least part of the goals)? If I have at least an example or two to look at, I can figure out how to accomplish the rest of the goals.

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      sc steinhayse wrote:

      1. I want to parse out specific nodes so that I can access the various level of nodes I am working with.

      An easy way to do this is to use Linq for XML. Take a look at this[^].

      sc steinhayse wrote:

      2. I would like to place various data elements in a collection/array that I can work with like an array.

      Using XLinq this is trivial. Read up on it and see how you can use things like ToList() or ToArray().

      *pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

      "Mind bleach! Send me mind bleach!" - Nagy Vilmos

      CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier

      S 1 Reply Last reply
      0
      • P Pete OHanlon

        sc steinhayse wrote:

        1. I want to parse out specific nodes so that I can access the various level of nodes I am working with.

        An easy way to do this is to use Linq for XML. Take a look at this[^].

        sc steinhayse wrote:

        2. I would like to place various data elements in a collection/array that I can work with like an array.

        Using XLinq this is trivial. Read up on it and see how you can use things like ToList() or ToArray().

        *pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

        "Mind bleach! Send me mind bleach!" - Nagy Vilmos

        CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier

        S Offline
        S Offline
        sc steinhayse
        wrote on last edited by
        #3

        Can you show mne more code examples than the link you pointed to?

        P 1 Reply Last reply
        0
        • S sc steinhayse

          Can you show mne more code examples than the link you pointed to?

          P Offline
          P Offline
          Pete OHanlon
          wrote on last edited by
          #4

          Sure. You can find examples of querying XML here[^]. If you were to post a simplified sample of the data structure you are talking about, I could show you a sample query or two that would mean more in the context of what you're trying to do.

          *pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

          "Mind bleach! Send me mind bleach!" - Nagy Vilmos

          CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier

          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