Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 30th, 2005, 03:02 PM
Registered User
 
Join Date: Dec 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default System.Xml.XmlException with XPath

Hello everybody,
When I try to read an XML file with XmlTextReader() method I get the System.Xml.XmlException.
My code is like this:

using System;
using System.IO;
using System.Xml;

public class Sample
{

  public static void Main()
   {
     XmlTextReader reader = new XmlTextReader(".\\.\\Books.xml");
     reader.WhitespaceHandling = WhitespaceHandling.None;

  while (reader.Read()) // Here where the error occurs.

{
    switch (reader.NodeType)
    {
     case XmlNodeType.Element:
     //
         break;
    case XmlNodeType.Text:
    //
        break;
    case XmlNodeType.EndElement:
        //
        break;
    case XmlNodeType.SignificantWhitespace:
    //
    break;
    }
  }
 }
}


 
Old December 31st, 2005, 03:55 AM
Registered User
 
Join Date: Dec 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to sky_handsome
Default

your xml file must be not in the right form.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Linq and namespaces System and System.Xml roman BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 6 July 4th, 2008 01:15 PM
XML: How to select a node with ' in it using Xpath guozai BOOK: Professional C#, 2nd and 3rd Editions 1 October 6th, 2006 12:37 PM
XPATH Help, Please- Excel XML Workbook jftaylor BOOK: XSLT Programmer's Reference, 2nd Edition 2 September 28th, 2006 08:47 PM
Read XML to DataSet with XPath? striker9 ASP.NET 2.0 Basics 1 July 25th, 2006 03:30 AM
Using XPath to get a certain field from XML (UPS) taleriana XML 4 May 24th, 2005 08:00 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.