Thread: xml parser

  1. #1
    Registered User
    Join Date
    Oct 2011
    Posts
    1

    xml parser

    Hi how to create an xml parser in c? Please help me hoe to write the code?

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,666
    Writing a simple one is as simple as
    Code:
    int ch;
    FILE *fp = fopen("file.xml","r");
    while ( (ch=fgetc(fp)) != EOF ) {
      if ( ch == '<' ) {
      } else.....
    }
    Writing a decent one that can cope with any xml document on the other hand takes a bit of effort.
    The Expat XML Parser
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need some help for parser
    By LINUX in forum C++ Programming
    Replies: 0
    Last Post: 01-25-2011, 04:52 PM
  2. SAX XML Parser
    By magic.mike in forum C++ Programming
    Replies: 1
    Last Post: 12-24-2008, 09:52 AM
  3. Help! Bad parser :/.
    By Blackroot in forum C++ Programming
    Replies: 13
    Last Post: 03-07-2006, 11:08 AM
  4. Parser Help
    By Barnzey in forum C++ Programming
    Replies: 10
    Last Post: 10-26-2005, 12:10 PM
  5. Parser - need help!
    By thelma in forum C Programming
    Replies: 2
    Last Post: 04-05-2004, 08:06 PM