working with xml
-
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.
-
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.
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()
orToArray()
.*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
-
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()
orToArray()
.*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
Can you show mne more code examples than the link you pointed to?
-
Can you show mne more code examples than the link you pointed to?
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