CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2006
    Posts
    170

    Question how to use xmldocument?

    Hello I want to make an xmldocument object not to be saved in a file. How do I use create element so that I get different levels of the nodes? Like this:

    Code:
    <root>
      <node1>
            test
      <\node1>
    <\root>
    Last edited by Visslan; February 13th, 2009 at 09:38 AM.

  2. #2
    Join Date
    Jul 2008
    Posts
    24

    Re: how to use xmldocument?

    I used these logic to read xml from a databse:

    Dim strSQL As string = "SELECT OrderId, OrderDate FROM Orders FOR XML AUTO,
    ELEMENTS"

    Dim xReader As New XMLReader()
    '...ADO.NET code to get a XMLReader

    Dim doc As New XMLDocument()
    doc.Load(xReader)
    xReader.Close()

    An exception generated in line doc.Load(xReader) because there is no root
    node in the result XML. Query the XML directly from SQL Query Analyser, I
    can get there:
    <Orders><OrderId>10248</OrderId><OrderDate>1996-07-04T00:00:00</OrderDate>
    </Orders>
    <Orders><OrderId>10249</OrderId><OrderDate>1996-07-04T00:00:00</OrderDate>
    </Orders>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured