Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP XML Using ASP 3 and XML. See also the XML category for more XML discussions not relating to ASP. NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 10th, 2005, 12:57 PM
Friend of Wrox
 
Join Date: Oct 2003
Location: Albany, NY, USA.
Posts: 218
Thanks: 0
Thanked 0 Times in 0 Posts
Default Can't get past "Token StartElement" error

I have been steadily building an XML output doc from an existing .NET web app. However, I just started getting the error "Token StartElement in state Epilog would result in an invalid XML document". From what I have read, it sounds like this means I am trying to append to an existing document - however, that document has been deleted.

Here's what I've stripped it down to, and it still gives the error.
Code:
Dim writer As New XmlTextWriter(path, Nothing)
writer.Formatting = Formatting.Indented
        writer.WriteStartDocument()
        writer.WriteStartElement("CounselingInformation")
        writer.WriteEndElement()
            For i = 0 To ds.Tables(0).Rows.Count - 1
                writer.WriteStartElement("CounselingRecord")
                writer.WriteEndElement()
            Next
        writer.WriteEndDocument()
        writer.Close()

Any ideas on why this would throw the error?

Thanks in advance for your comments.
 
Old August 10th, 2005, 01:21 PM
Friend of Wrox
 
Join Date: Oct 2003
Location: Albany, NY, USA.
Posts: 218
Thanks: 0
Thanked 0 Times in 0 Posts
Default

<oops>
In line 5 of my code, I closed the root element before I started the content loop.
</oops>

Live and learn, I guess.

- - - - - - - - - - - - - - - - - - - - - - -
In God we trust, everything else we test.




Similar Threads
Thread Thread Starter Forum Replies Last Post
xpath contains error 'has an invalid token' XMLUser XSLT 7 February 5th, 2008 02:31 AM
error LNK2020 unresolved token rachappa Visual C++ 1 January 12th, 2006 08:05 AM
past titles oxygen_fiend All Other Wrox Books 1 September 6th, 2005 10:49 AM
Token error using process.start Raif ASP.NET 1.0 and 1.1 Professional 3 August 17th, 2004 08:42 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.