Part2 csv to xml

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?cm9kY2hhcg==?=

    #1

    Part2 csv to xml

    hey all,

    <document>
    <RecordLine>
    <CoordX>3</CoordX >
    <CoordY>1</CoordY >
    <DataType>B</DataType >
    </RecordLine>
    </document>


    in vb i can easily say string.split(", ") and control the string from there
    but i do begin to do that with xml? any good beginner .net articles on how to
    do this? any words of encouragement?

    thanks,
    rodchar
  • Chris Dunaway

    #2
    Re: Part2 csv to xml

    On Jun 12, 3:12 pm, rodchar <rodc...@discus sions.microsoft .comwrote:
    hey all,
    >
    <document>
    <RecordLine>
    <CoordX>3</CoordX >
    <CoordY>1</CoordY >
    <DataType>B</DataType >
    </RecordLine>
    </document>
    >
    in vb i can easily say string.split(", ") and control the string from there
    but i do begin to do that with xml? any good beginner .net articles on how to
    do this? any words of encouragement?
    >
    thanks,
    rodchar
    Normally with xml you will use XPath or and XmlReader to navigate the
    nodes of the xml. It's not clear from this post or your other post
    what you are trying to accomplish. Are you trying to create xml from
    some other source?

    One way would be to create a class called Document that includes
    properties for the data you have described above and use the Xml
    Serializer to create the xml for you. But you'll need to provide more
    information.

    Chris

    Comment

    • =?Utf-8?B?RmFtaWx5IFRyZWUgTWlrZQ==?=

      #3
      RE: Part2 csv to xml

      Clearly you should use whatever format is optimal for you to solve the
      required problem. XML works great for serializing objects within an
      application or for interoperabilit y between applications.

      You seem to be comparing to CSV, so I will say that CSV works great
      sometimes. When you run into data that the strings contain commas and
      quotes, the trivial string.split(", ") logic fails. Also you need to remember
      to trim in case extra spaces are present.

      My personal gripe on CSV reading is where the matrix is irregular, meaning
      that it is not a matrix of Rows X Columns data, but rather a set of Rows
      arrays of varying sizes, such as:

      Honda, Pilot, Accord, Civic, Odessey
      Toyota, Prius, Highlander, Camrey
      Ford, Pinto

      Just my 2 yen...


      "rodchar" wrote:
      hey all,
      >
      <document>
      <RecordLine>
      <CoordX>3</CoordX >
      <CoordY>1</CoordY >
      <DataType>B</DataType >
      </RecordLine>
      </document>
      >
      >
      in vb i can easily say string.split(", ") and control the string from there
      but i do begin to do that with xml? any good beginner .net articles on how to
      do this? any words of encouragement?
      >
      thanks,
      rodchar

      Comment

      Working...