473,405 Members | 2,210 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,405 software developers and data experts.

XmlTextReader problem

Hi

I have a http xml post that I'm trying to read using xmltextreader.

This is the xml:
<?xml version="1.0"?>
<userlist ACTION="newuser" VENDORNAME="H2Digital">
<amouser AMOAID="101" AMOUSERNAME="Billy hill" AMOAROLES="Student"
AMOAPRODUCTS="intralase,VISX,ILASKI" />
</userlist>

This is the code I'm using to read this
Page.Response.ContentType = "text/xml"

stream = New System.IO.StreamReader(Page.Request.InputStream)

Dim reader As System.Xml.XmlTextReader = New
System.Xml.XmlTextReader(stream)

Do While reader.Read()

When the code gets to line - 'Do while reader.read' - I get exception that
root element is missing - but xml file does have a root element.

I noticed when watching the reader during debug that the linenumber and
lineposition has strange character '&HO' in it.

This was all working fine for a while and then suddenly the reader started
up with this.

Does anyone know what is going on?

Thanks,

CindyH
Jun 27 '08 #1
2 1404
Hi

I just wanted to add that during debugging I'm getting 0 length and 0
position on page.request.inputstream.

Page.Request.InputStream.Length()

Page.Request.InputStream.Position

So its kind of looking like for some reason the page.request.inputstream
stopped working.

Thanks,

Cindy


"CindyH" <ch*******@new.rr.comwrote in message
news:O2**************@TK2MSFTNGP06.phx.gbl...
Hi

I have a http xml post that I'm trying to read using xmltextreader.

This is the xml:
<?xml version="1.0"?>
<userlist ACTION="newuser" VENDORNAME="H2Digital">
<amouser AMOAID="101" AMOUSERNAME="Billy hill" AMOAROLES="Student"
AMOAPRODUCTS="intralase,VISX,ILASKI" />
</userlist>

This is the code I'm using to read this
Page.Response.ContentType = "text/xml"

stream = New System.IO.StreamReader(Page.Request.InputStream)

Dim reader As System.Xml.XmlTextReader = New
System.Xml.XmlTextReader(stream)

Do While reader.Read()

When the code gets to line - 'Do while reader.read' - I get exception that
root element is missing - but xml file does have a root element.

I noticed when watching the reader during debug that the linenumber and
lineposition has strange character '&HO' in it.

This was all working fine for a while and then suddenly the reader started
up with this.

Does anyone know what is going on?

Thanks,

CindyH


Jun 27 '08 #2
CindyH wrote:
I just wanted to add that during debugging I'm getting 0 length and 0
position on page.request.inputstream.

Page.Request.InputStream.Length()

Page.Request.InputStream.Position

So its kind of looking like for some reason the page.request.inputstream
stopped working.
Use a tool like ethereal to check whether the HTTP request really is a
POST request with a request body.
--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Jun 27 '08 #3

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

Similar topics

4
by: Meir S. | last post by:
I think the following is a bug in XmlTextReader: I need to process large XMLs, that are typically constructed of many small elements nested in the root element. Each inner element represents a...
3
by: Pete | last post by:
I'm trying to read an XML document and write out a slightly modified version using the XmlTextWriter. I'm basically trying to copy all the nodes exactly as they are read and do some text...
4
by: Andy Neilson | last post by:
I've run across a strange behaviour with XmlSerializer that I'm unable to explain. I came across this while trying to use XmlSerializer to deserialize from a the details of a SoapException. This...
5
by: Geoff Bennett | last post by:
While parsing an XML document, my TextReader instance skips nodes. For example, in this fragment: <Person Sex="Male" FirstHomeBuyer="No" YearsInCurrentProfession="14"> <RelatedEntityRef...
1
by: edi | last post by:
Hi, I have MS .Net Framework v1.1.4322. I have this XML file: <?xml version="1.0" ?> <!--here there are two spaces at the beginning--> <aaa> <a id="1"> <Dept>Finance</Dept>
1
by: RJN | last post by:
Hi I'm using XMLTextReader to parse the contents of XML. I have issues when the xml content itself has some special characters like & ,> etc. <CompanyName>Johnson & Jhonson</CompanyName>...
1
by: SHC | last post by:
Hi all, I did the "Build" on the attached code in my VC++ .NET 2003 - Windows XP Pro PC. On the c:\ screen, I got the following: Microsoft Development Environment An unhandled exception of type...
2
by: Q | last post by:
I am feeding XmlTextReader a URL that returns the XML that then gets parsed. The URL forms a query that affects how much data is returned in XML but not the format of the data. The problem is...
1
by: Borgbjerg | last post by:
I've got a multi-threaded server (we are very early in the project, trying to uncover some risks), and I want to send data using XML. The class ServerAdapter is supposed to connect to the server...
4
by: Paul Bromley | last post by:
I thought that XMLTextReader would be simple to use, but I have run into problems with it! I seem to have great difficulty extrcting the text of specific elements from a very simple XML file. I...
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: 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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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.