VB.NET: Writing attribute and Elements to Xml

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • http://www.visual-basic-data-mining.net/forum

    #1

    VB.NET: Writing attribute and Elements to Xml

    Say i have this Xml file

    <Books>
    <Book type="1">
    <Author>Peter </Author>
    <Section>1</Section>
    </Book>
    </Books>

    how to create another automatic set of IDs and datas for the Xml tag so that
    when i type in another set of data...

    The content of the Xml file will become:

    <Books>
    <Book type="1">
    <Author>Peter </Author>
    <Section>1</Section>
    </Book>
    <Book type="2">
    <Author>John</Author>
    <Section>2</Section>
    </Book>
    </Books>

    Thanks

    --
    toytoy - forum member
    Visual Studio dev tools & services make app development easy for any developer, on any platform & language. Develop with our code editor or IDE anywhere for free.



  • Emilia

    #2
    RE: VB.NET: Writing attribute and Elements to Xml

    Did you manage to solve it? I am facing the same problem, so if you found a
    solution, please could you let me know?

    "http://www.visual-basic-data-mining.net/" wrote:
    [color=blue]
    > Say i have this Xml file
    >
    > <Books>
    > <Book type="1">
    > <Author>Peter </Author>
    > <Section>1</Section>
    > </Book>
    > </Books>
    >
    > how to create another automatic set of IDs and datas for the Xml tag so that
    > when i type in another set of data...
    >
    > The content of the Xml file will become:
    >
    > <Books>
    > <Book type="1">
    > <Author>Peter </Author>
    > <Section>1</Section>
    > </Book>
    > <Book type="2">
    > <Author>John</Author>
    > <Section>2</Section>
    > </Book>
    > </Books>
    >
    > Thanks
    >
    > --
    > toytoy - forum member
    > http://www.visual-basic-data-mining.net/forum
    >
    >
    >[/color]

    Comment

    • Oleg Tkachenko [MVP]

      #3
      Re: VB.NET: Writing attribute and Elements to Xml

      http://www.visual-basic-data-mining.net/forum wrote:
      [color=blue]
      > <Books>
      > <Book type="1">
      > <Author>Peter </Author>
      > <Section>1</Section>
      > </Book>
      > </Books>
      >
      > how to create another automatic set of IDs and datas for the Xml tag so that
      > when i type in another set of data...
      >
      > The content of the Xml file will become:
      >
      > <Books>
      > <Book type="1">
      > <Author>Peter </Author>
      > <Section>1</Section>
      > </Book>
      > <Book type="2">
      > <Author>John</Author>
      > <Section>2</Section>
      > </Book>
      > </Books>[/color]

      Load XML into XmlDocument, create and append new data and save it back.
      See
      http://msdn.microsoft.com/library/de...NodesInDOM.asp
      how to create new nodes in XmlDocument.

      --
      Oleg Tkachenko [XML MVP]

      Comment

      Working...