Click here to Skip to main content
15,886,963 members
Home / Discussions / C#
   

C#

 
GeneralRe: barcode Pin
GuyThiebaut30-Sep-07 8:25
professionalGuyThiebaut30-Sep-07 8:25 
GeneralRe: barcode Pin
k36madman30-Sep-07 10:43
k36madman30-Sep-07 10:43 
QuestionRadio Buttons Pin
picasso229-Sep-07 7:52
picasso229-Sep-07 7:52 
AnswerRe: Radio Buttons Pin
Lutosław29-Sep-07 8:59
Lutosław29-Sep-07 8:59 
QuestionObject reference not set to an instance of an object. Pin
anydie29-Sep-07 7:20
anydie29-Sep-07 7:20 
AnswerRe: Object reference not set to an instance of an object. Pin
Luc Pattyn29-Sep-07 7:55
sitebuilderLuc Pattyn29-Sep-07 7:55 
AnswerRe: Object reference not set to an instance of an object. Pin
Guffa29-Sep-07 7:57
Guffa29-Sep-07 7:57 
QuestionxmlTextReader [modified] Pin
jon-8029-Sep-07 6:46
professionaljon-8029-Sep-07 6:46 
Why is the value of the tags not being read when the code reads System.xml.XmlTextReader.Text property?

Hence within element <column> column 1 is not being read as text


Note: "sample.xml" is not being rendered well. Tried using HTML escape characters to display a sample but it was unsuccessful. See the code below.

using System;
using System.Xml;

namespace ReadXMLfromFile
{
    /// <summary>
    /// Summary description for Class1.
    /// </summary>
    class Class1
    {
        static void Main(string[] args)
        {
            XmlTextReader reader = new XmlTextReader("sample.xml");
            while (reader.Read())
            {
{
       switch (reader.NodeType) 
       {
           case XmlNodeType.Element: // The node is an element.
               Console.Write("<" + reader.Name);

               while (reader.MoveToNextAttribute()) // Read the attributes.
                Console.Write(" " + reader.Name + "='" + reader.Value + "'");
                Console.WriteLine(">");
               break;
            case XmlNodeType.Text: //Display the text in each element. SHOULD THIS READ THE TEXT VALUE OF NODES?
               Console.WriteLine (reader.Value);
               break;
            case XmlNodeType. EndElement: //Display the end of the element.
                Console.Write("");
                break;
       }}}}}}

(source: MSDN)

sample.xml
----------

<database schema-name="products">

	<column data-type="text" name="Code" pk="true" fkreferences="Product.Code">    column 1
	<column data-type="int" name="Qty">	  column 2
  <column data-type="currency" name="CostPrice">    column 3
	<table name="ProductsInStock">		</table>

	<column data-type="text" name="ProductID" pk="true">	column 1
  <column data-type="text" name="Description">	column 2
  <table name="Product">	</table>

------------------
 


 -- modified at 13:26 Saturday 29th September, 2007 


 -- modified at 5:24 Sunday 30th September, 2007 


 -- modified at 5:26 Sunday 30th September, 2007 

<div class="ForumSig">Jon</div>

Questionimage DBNull Pin
TAREQ F ABUZUHRI29-Sep-07 6:19
TAREQ F ABUZUHRI29-Sep-07 6:19 
AnswerRe: image DBNull Pin
Christian Graus29-Sep-07 11:33
protectorChristian Graus29-Sep-07 11:33 
Question.NET arbitrary precision arithmetic library Pin
thepersonof29-Sep-07 5:55
thepersonof29-Sep-07 5:55 
AnswerRe: .NET arbitrary precision arithmetic library Pin
thepersonof29-Sep-07 8:01
thepersonof29-Sep-07 8:01 
GeneralRe: .NET arbitrary precision arithmetic library Pin
Luc Pattyn29-Sep-07 8:07
sitebuilderLuc Pattyn29-Sep-07 8:07 
QuestionRegarding regular expressions Pin
anu8129-Sep-07 0:22
anu8129-Sep-07 0:22 
AnswerRe: Regarding regular expressions Pin
S. Senthil Kumar29-Sep-07 6:43
S. Senthil Kumar29-Sep-07 6:43 
QuestionI need help really!!!! Pin
chanzeb28-Sep-07 23:49
chanzeb28-Sep-07 23:49 
AnswerRe: I need help really!!!! Pin
Guffa29-Sep-07 0:05
Guffa29-Sep-07 0:05 
GeneralRe: I need help really!!!! Pin
Christian Graus29-Sep-07 0:27
protectorChristian Graus29-Sep-07 0:27 
GeneralRe: I need help really!!!! Pin
chanzeb29-Sep-07 0:34
chanzeb29-Sep-07 0:34 
QuestionIcon resource causing compile error Pin
DaveyM6928-Sep-07 23:24
professionalDaveyM6928-Sep-07 23:24 
Question[Message Deleted] Pin
svincoll428-Sep-07 23:13
svincoll428-Sep-07 23:13 
AnswerRe: How to optimize this code ? Pin
Guffa28-Sep-07 23:35
Guffa28-Sep-07 23:35 
GeneralRe: How to optimize this code ? Pin
svincoll428-Sep-07 23:39
svincoll428-Sep-07 23:39 
GeneralRe: How to optimize this code ? Pin
Guffa29-Sep-07 0:02
Guffa29-Sep-07 0:02 
GeneralRe: How to optimize this code ? Pin
svincoll429-Sep-07 0:04
svincoll429-Sep-07 0:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.