473,791 Members | 3,097 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XMLTextReader is not defined

im trying to read an xml file which is in the wwwroot folder.im using IIS on
XP Prof.
my code is
--------------------------------------------------------------------------------------------------------
<%@ Page Language="VB" Debug="true" codePage="28599 " %>
<script runat="server">
Sub Page_Load(Sende r as Object,E As EventArgs)
dim okuyucu as XMLTextReader
okuyucu=new XMLTextReader(S erver.MapPath(" comments.xml"))

while okuyucu.Read()
Response.Write( "<b>" & okuyucu.Name & "</b>" & okuyucu.Value & "<br>")
End While
okuyucu.close
End Sub
</script>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html"; charset=iso-8859-9">
</head>
<body>
</body>
</html
---------------------------------------------------------------------------------------------------------
but i get the following error message,why?
---------------------------------------------------------------------------------------------------------
Description: An error occurred during the compilation of a resource required
to service this request. Please review the following specific error details
and modify your source code appropriately.

Compiler Error Message: BC30002: Type 'XMLTextReader' is not defined.

Source Error:

Line 2: <script runat="server">
Line 3: Sub Page_Load(Sende r as Object,E As EventArgs)
Line 4: dim okuyucu as XMLTextReader
Line 5: okuyucu=new XMLTextReader(S erver.MapPath(" comments.xml"))
Line 6:
Source File: c:\inetpub\wwwr oot\XMLRead.asp x Line: 4
---------------------------------------------------------------------------------------------------------
Nov 19 '05 #1
2 2108


XML reading with XMLTextReader wrote:
im trying to read an xml file which is in the wwwroot folder.im using IIS on
XP Prof.
my code is :
--------------------------------------------------------------------------------------------------------
<%@ Page Language="VB" Debug="true" codePage="28599 " %>


Try to add
<%@ Import Namespace="Syst em.Xml" %>
here.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Nov 19 '05 #2
Try adding System.Xml to you XMLTextReader declaration.

dim okuyucu as System.Xml.XmlT extReader
okuyucu = new System.Xml.XmlT extReader( .... )

bill

"XML reading with XMLTextReader" <XML reading with
XM***********@d iscussions.micr osoft.com> wrote in message
news:0E******** *************** ***********@mic rosoft.com...
im trying to read an xml file which is in the wwwroot folder.im using IIS on XP Prof.
my code is :
-------------------------------------------------------------------------- ------------------------------ <%@ Page Language="VB" Debug="true" codePage="28599 " %>
<script runat="server">
Sub Page_Load(Sende r as Object,E As EventArgs)
dim okuyucu as XMLTextReader
okuyucu=new XMLTextReader(S erver.MapPath(" comments.xml"))

while okuyucu.Read()
Response.Write( "<b>" & okuyucu.Name & "</b>" & okuyucu.Value & "<br>")
End While
okuyucu.close
End Sub
</script>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html"; charset=iso-8859-9">
</head>
<body>
</body>
</html>
-------------------------------------------------------------------------- ------------------------------- but i get the following error message,why? :
-------------------------------------------------------------------------- ------------------------------- Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: BC30002: Type 'XMLTextReader' is not defined.

Source Error:

Line 2: <script runat="server">
Line 3: Sub Page_Load(Sende r as Object,E As EventArgs)
Line 4: dim okuyucu as XMLTextReader
Line 5: okuyucu=new XMLTextReader(S erver.MapPath(" comments.xml"))
Line 6:
Source File: c:\inetpub\wwwr oot\XMLRead.asp x Line: 4
--------------------------------------------------------------------------

-------------------------------
Nov 19 '05 #3

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

Similar topics

4
11402
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 should have worked fine since the class in question was already being serialized and deserialized as part of a Web service interface. What I found was that by deserializing from an XmlNodeReader instead of an XmlTextReader, XML Serialization doesn't work...
5
9219
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 RelatedID="118"/> <PersonName> <NameTitle Value="Mr"/> <FirstName>Clint</FirstName> <OtherName/> <AlsoKnownAs>Mr C Eastwood</AlsoKnownAs>
2
4170
by: Yuriy | last post by:
Hi, any ideas how to read XML fragment from TextReader? XmlTextReader constructor accepts only Stream or string as source Do I miss something? thanks Yuriy
1
5460
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> <EmployeeStrength>> 1000</EmployeeStrength> When I do a Xmltextreader.read() and then check the contents of the xml node by XmltextReader.ReadString(), I get an exception when I have
1
2255
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 'System.Xml.XmlException' occured in system.xml.dll Addtional Information: System error |Break| |Continue| I clicked on the |Continue| and I got the following: "c:\Documents and Settings\Scott H. Chang\My Documents\Visual Studio...
3
1859
by: Kjeld | last post by:
My scenario: I'm using an XmlTextReader to Deserialize serveral classes from a single xml document. Every class i pass the source stream, containing the xml. Each class subsequently creates an XmlTextReader object with that stream as input. However, the second class that performs this operation cannot start reading at position X, because the first instance of XmlTextReader advanced the position in the stream to the end of the stream....
2
3818
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 that when the URL string exceeds about 163 characters (strange number) XmlTextReader seems to choke on it and it doesn't seem like any XML is actually being returned and the code throws an exception on reading the first element. Shorter URL strings...
4
44965
by: CodeRazor | last post by:
I am reading an xml file from a URL. I was originally doing this using the XmlDocument class. But this was very slow. The XmlTextReader is meant to be much quicker for forward only retrieval of data. I need to somehow access a particular list of nodes. e.g. I want to loop through all the nodes called <item></item>. How is this possible using XmlTextReader? I can see that you can get the .Value property of XmlTextReader. But I want to...
4
6025
by: CodeRazor | last post by:
I am trying to use an XmlTextReader to retrieve data. I need to use an XmlTextReader because it is faster than using an XmlDocument. I have found an inelegant way of retrieving each item's title and description using string methods. See my code below. I would like to know how I can retrieve the <title> and <description> nodes more directly using the methods of the XmlTextReader. My xml file looks somthing like: <items>
0
9669
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9515
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10427
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10155
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9995
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9029
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6776
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5559
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4110
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.