Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 12-08-2009
Member
 
Join Date: Nov 2008
Posts: 240
Example of XmlTextReader

What is the syntax to Initializes XmlTextReader and what are code for reading Reading XML Files with the XmlTextReader Class. Can any one give me some xmltextreader example?
Reply With Quote
  #2  
Old 12-08-2009
Member
 
Join Date: May 2008
Posts: 2,293
Re: Example of XmlTextReader

XmlTextReader provides forward-only, read-only access to a stream of XML data. XMLTextReader Reads XML data and iterates over nodes. You may set XML source as one of parameters (xmlString or xmlData).
Reply With Quote
  #3  
Old 12-08-2009
Member
 
Join Date: Jan 2009
Posts: 199
Re: Example of XmlTextReader

This is the XmlTextReader example in C :
Code:
#include <libxml/xmlreader.h>
void processNode(xmlTextReaderPtr reader) {
    }

int xml file(char *flnm) {
    xmlTextReaderPtr reader;
    int r;

    reader = xmlNewTextReaderFilename(flnm);
    if (reader != NULL) {
        r = xmlTextReaderRead(reader);
        while (r == 1) {
            processNode(reader);
            r = xmlTextReaderRead(reader);
        }
        xmlFreeTextReader(reader);
        if (r != 0) {
            printf("%s : failed to parse\n", filename);
        }
    } else {
        printf("Unable to open %s\n", filename);
    }
}
Reply With Quote
  #4  
Old 12-08-2009
Member
 
Join Date: Dec 2008
Posts: 177
Re: Example of XmlTextReader

Read xml document by using the XmlTextReader :
Code:
Imports System.Xml.Serialization, System.IO
Imports System.Xml
Public Class Tester
    Public Shared Sub Main
    
      Dim xmlread As New XmlTextReader("read.xml")
     xmlread.ReadStartElement("UserChoice")
      Do While xmlread.Read()
         If xmlread.Name = "UserChoice" Then Exit Do

         Console.WriteLine(xmlread.ReadOuterXml)

      Loop
      xmlread.Close()

    End Sub

End Class
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search



All times are GMT +5.5. The time now is 07:38 AM.