Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Well-Formed XML from Event Handers?

Reply
Thread Tools

Well-Formed XML from Event Handers?

 
 
pbd22
Guest
Posts: n/a
 
      03-13-2007
Hi.

How do i output a well-formed XML document from inside an active event
handler? I tried this in VB.NET (using a stringbuilder) and I kept
getting a parser error. Has anybody run into this problem and what was
the solution?

I thank you.
Peter

 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      03-13-2007
pbd22 wrote:

> How do i output a well-formed XML document from inside an active event
> handler? I tried this in VB.NET (using a stringbuilder) and I kept
> getting a parser error. Has anybody run into this problem and what was
> the solution?


What kind of "event handler" are you talking about? Is that the ASP.NET
page model? What else does the page contain besides the code for the
event handler?


--

Martin Honnen
http://JavaScript.FAQTs.com/
 
Reply With Quote
 
 
 
 
pbd22
Guest
Posts: n/a
 
      03-13-2007
On Mar 13, 10:17 am, Martin Honnen <(E-Mail Removed)> wrote:
> pbd22 wrote:
> > How do i output a well-formed XML document from inside an active event
> > handler? I tried this in VB.NET (using a stringbuilder) and I kept
> > getting a parser error. Has anybody run into this problem and what was
> > the solution?

>
> What kind of "event handler" are you talking about? Is that the ASP.NET
> page model? What else does the page contain besides the code for the
> event handler?
>
> --
>
> Martin Honnen
> http://JavaScript.FAQTs.com/



Thanks for your reply Martin.

Its VB.NET/ASP.NET 2.0 and the event handler is a custom handler that
gets fired every time a byte is sent to a remote server for FTP. The
only
other method on the page is a Page_Load event that handles the upload
of the files. Below is the event handler. I currently get a parser
error becuase
it keeps recreating the XML every time the event handler fires and I
cant
figure out how to avoid this - I need to replace/update it, not append
to it.


Public Sub onIncrementCallback(ByVal sender As Object, ByVal e As
IncrementEventArgs)

Dim sbhtml As StringBuilder = New StringBuilder
sbhtml.Append("<?xml version='1.0' encoding='ISO-8859-1'?
>")

sbhtml.Append("<uploads>")
sbhtml.Append("<upload>")
sbhtml.Append("<filename>")
sbhtml.Append(e.FileName)
sbhtml.Append("</filename>")
sbhtml.Append("<bytessent>")
sbhtml.Append(e.BytesSent)
sbhtml.Append("</bytessent>")
sbhtml.Append("<filesize>")
sbhtml.Append(e.TotalBytesToSend)
sbhtml.Append("</filesize>")
sbhtml.Append("<percent>")
sbhtml.Append(e.ProgressPercentage)
sbhtml.Append("</percent>")
sbhtml.Append("</upload>")
sbhtml.Append("</uploads>")
Context.Response.ContentType = "text/xml"
Response.Write(sbhtml.ToString)
End Sub

Thanks for your help,
Peter

 
Reply With Quote
 
Martin Honnen
Guest
Posts: n/a
 
      03-13-2007
pbd22 wrote:

> it keeps recreating the XML every time the event handler fires and I
> cant
> figure out how to avoid this - I need to replace/update it, not append
> to it.


Ask in an ASP.NET group or forum.



--

Martin Honnen
http://JavaScript.FAQTs.com/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Different results parsing a XML file with XML::Simple (XML::Sax vs. XML::Parser) Erik Wasser Perl Misc 5 03-05-2006 10:09 PM
Print XML parsing to JspWriter (out) Class org.xml.sax.helpers.NewInstance can not access a member of class javax.xml.parsers.SAXParser with modifiers "protected" Per Magnus L?vold Java 0 11-15-2004 02:27 PM
embedding xml in xml as non-xml :) Mark Van Orman XML 5 09-15-2004 05:57 AM
What XML technologies to learn first for "XML Processing" and "XML Mapping"? Bomb Diggy Java 0 07-28-2004 07:26 AM
Help on including one XML document within another XML document using XML Schemas Tony Prichard XML 0 12-12-2003 03:18 PM



Advertisments