473,396 Members | 1,772 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Well-Formed XML from Event Handers?

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

Mar 13 '07 #1
3 1349
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/
Mar 13 '07 #2
On Mar 13, 10:17 am, Martin Honnen <mahotr...@yahoo.dewrote:
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

Mar 13 '07 #3
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/
Mar 13 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

45
by: Market Mutant | last post by:
I just wonder job selections, job openings and salary level of PHP programer or Perl programmer comparing to Java programmers. Is Java programmer's salary has a minimal of 60K in US? Are there...
14
by: delerious | last post by:
Is there a list of well designed web sites anywhere? Or could you please list some that you think are well designed? Thanks!
58
by: Jeff_Relf | last post by:
Hi Tom, You showed: << private const string PHONE_LIST = "495.1000__424.1111___(206)564-5555_1.800.325.3333"; static void Main( string args ) { foreach (string phoneNumber in Regex.Split...
3
by: Will Woodhull | last post by:
Hi, I'm new here-- I've been reading the group for a couple of days. Nice group; I like the way n00b33 questions are handled. I've been using a Javascript routine in index.html to determine a...
13
by: Adam H. Peterson | last post by:
I just made an observation and I wondered if it's generally known (or if I'm missing something). My observation is that static protected members are essentially useless, only a hint to the user. ...
13
by: Ben | last post by:
Could anyone suggest an open source project that has particularly well written Python? I am especially looking for code that people would describe as "very Python-ic". (Not trying to start any...
16
by: Tom Zych | last post by:
Hi. I've been using code like this: *p++ = 'x'; *p++ = *q++; for a long time now. It works. The code below compiles with no warnings and runs correctly. Even splint doesn't complain about...
6
by: M Welinder | last post by:
The title more or less says it all: in C99, is the value of INT_MIN % -1 well defined (when performed as signed integers) under the assumption of two-complement representation. Note, that...
1
by: ad | last post by:
I want to determinate if a xml is well-format and valid before export it to database. We can determinate if xml is valid from the article:...
138
by: Ian Boyd | last post by:
i've been thrown into a pit with DB2 and have to start writing things such as tables, indexes, stored procedures, triggers, etc. The online reference is only so helpful. The two pdf manuals are...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.