Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   XML (http://www.velocityreviews.com/forums/f32-xml.html)
-   -   XML Parsing Error: junk after document element (http://www.velocityreviews.com/forums/t483762-xml-parsing-error-junk-after-document-element.html)

pbd22 03-12-2007 11:27 PM

XML Parsing Error: junk after document element
 

Hi.

I have an event handler in VB.NET that gets called several times.
The output of the event handler is XML that is being called by
an xmlhttp request from the client.

I am using a stringbuilder to create the XML document by
appending the various parts:

sbhtml.Append("<Some XML Tag>")

The problem is that the XML document gets recreated every
time the event handler fires and I get the junk error after the
first document's parent tag is closed:

XML Parsing Error: junk after document element

Location: http://localhost:5223/PresentationTi..._progress.aspx
Line Number 1, Column 191:<?xml version='1.0' encoding='ISO-8859-1'?
><uploads><upload><filename>SomeVideo.gvi</filename><bytessent>0</

bytessent><filesize>12444894</filesize><percent>0</percent></upload></
uploads><?xml version='1.0' encoding='ISO-8859-1'?> ...

SO: How do I prevent this? How Do I "UPDATE" the XML document every
time the event handler fires and not "APPPEND" a new document to the
recently created one?

Thanks.
Peter


Joe Kesselman 03-12-2007 11:54 PM

Re: XML Parsing Error: junk after document element
 
> XML Parsing Error: junk after document element

An XML document must have one, and only one, top level element. You
can't append to it; you have to actually read the document in and
process it properly, inserting the new structure in a place that makes
sense syntactically.

Or -- a sloppy workaround, but sometimes useful -- don't append to your
top-level document, but to an External Parsed Entity which is referenced
by your document. External entities *can* be document fragments and have
multiple top-level elements, if they're referenced in an appropriate place.

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry

pbd22 03-13-2007 12:04 AM

Re: XML Parsing Error: junk after document element
 
On Mar 12, 4:54 pm, Joe Kesselman <keshlam-nos...@comcast.net> wrote:
> > XML Parsing Error: junk after document element

>
> An XML document must have one, and only one, top level element. You
> can't append to it; you have to actually read the document in and
> process it properly, inserting the new structure in a place that makes
> sense syntactically.
>
> Or -- a sloppy workaround, but sometimes useful -- don't append to your
> top-level document, but to an External Parsed Entity which is referenced
> by your document. External entities *can* be document fragments and have
> multiple top-level elements, if they're referenced in an appropriate place.
>
> --
> () ASCII Ribbon Campaign | Joe Kesselman
> /\ Stamp out HTML e-mail! | System architexture and kinetic poetry



Thanks for the response Joe.
After rereading my post, I am realizing this isn't an XML issue.
I understand that my document isn't well-formed, I guess I am
trying to figure out how to prevent the event handler from recreating
the XML and hence, causing the "junk" error. I think this is a
VB.NET issue. I'll repost. Thanks...



All times are GMT. The time now is 12:26 PM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57