XMLTextReader is not defined

Discussion in 'ASP .Net' started by =?Utf-8?B?WE1MIHJlYWRpbmcgd2l0aCBYTUxUZXh0UmVhZGVy, Jan 26, 2005.

  1. 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(Sender as Object,E As EventArgs)
    dim okuyucu as XMLTextReader
    okuyucu=new XMLTextReader(Server.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(Sender as Object,E As EventArgs)
    Line 4: dim okuyucu as XMLTextReader
    Line 5: okuyucu=new XMLTextReader(Server.MapPath("comments.xml"))
    Line 6:


    Source File: c:\inetpub\wwwroot\XMLRead.aspx Line: 4
    ---------------------------------------------------------------------------------------------------------
     
    =?Utf-8?B?WE1MIHJlYWRpbmcgd2l0aCBYTUxUZXh0UmVhZGVy, Jan 26, 2005
    #1
    1. Advertising

  2. 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="System.Xml" %>
    here.

    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Jan 26, 2005
    #2
    1. Advertising

  3. Try adding System.Xml to you XMLTextReader declaration.

    dim okuyucu as System.Xml.XmlTextReader
    okuyucu = new System.Xml.XmlTextReader( .... )

    bill

    "XML reading with XMLTextReader" <XML reading with
    > wrote in message
    news:...
    > 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(Sender as Object,E As EventArgs)
    > dim okuyucu as XMLTextReader
    > okuyucu=new XMLTextReader(Server.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(Sender as Object,E As EventArgs)
    > Line 4: dim okuyucu as XMLTextReader
    > Line 5: okuyucu=new XMLTextReader(Server.MapPath("comments.xml"))
    > Line 6:
    >
    >
    > Source File: c:\inetpub\wwwroot\XMLRead.aspx Line: 4
    > --------------------------------------------------------------------------

    -------------------------------
     
    William F. Robertson, Jr., Jan 26, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. DotNet

    XmlTextReader

    DotNet, Feb 6, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    444
    Chris Jackson
    Feb 6, 2004
  2. Simon Harris

    XMLTextReader

    Simon Harris, May 10, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    493
    Simon Harris
    May 11, 2005
  3. Amil
    Replies:
    2
    Views:
    3,340
    Naveen K Kohli
    Feb 6, 2006
  4. Oodini
    Replies:
    1
    Views:
    1,802
    Keith Thompson
    Sep 27, 2005
  5. Eivind Gussiås Løkseth

    XmlTextReader not able to find DTD file

    Eivind Gussiås Løkseth, Jul 23, 2008, in forum: ASP .Net
    Replies:
    1
    Views:
    409
    Martin Honnen
    Jul 23, 2008
Loading...

Share This Page