Thread: XML parsing without using a parser

  1. #1
    Registered User
    Join Date
    Dec 2012
    Posts
    1

    XML parsing without using a parser

    hello

    i have some UML models given in the form of XMI files and i need to load these model in to memory to do some manipulations. so for this im planning on using C , without using a 3rd party parser.
    i would be grateful to you all if you can give me some pointers that can be helpful to achieve this task.

  2. #2
    Registered User
    Join Date
    May 2012
    Posts
    505
    Go onto my website and download the vanilla xml parser.
    It's not a complete parser, hence the "vanilla", but it will almost certainly do what you want.
    I'm the author of MiniBasic: How to write a script interpreter and Basic Algorithms
    Visit my website for lots of associated C programming resources.
    https://github.com/MalcolmMcLean


  3. #3
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    If you do want to write your own, it isn't too complicated. Look up "recursive descent parser" and it should give you some ideas for a simple way to structure your algorithm. You should also be familiar with all the C functions for processing strings like strtok, etc.

    edit: What iMalc says below is true. Writing an XML parser can be a good learning exercise, but if this is for real work, the benefits of using a proven xml parser far outweigh any drawbacks.

  4. #4
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,318
    Every time some project at work has been done without a proper XML parser, or any time the third party component didn't use a proper XML parser, it has gone badly wrong. I stongly urge you to not even think of going there.
    I'm sorry but all you'll get out of me on this endevaour will be an "I told you so".
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. xml parser
    By holbond in forum C Programming
    Replies: 1
    Last Post: 10-10-2011, 06:01 AM
  2. Replies: 2
    Last Post: 03-11-2011, 04:45 AM
  3. String parsing(parsing comments out of HTML file)
    By slcjoey in forum C# Programming
    Replies: 0
    Last Post: 07-29-2006, 08:28 PM
  4. Parser - need help!
    By thelma in forum C Programming
    Replies: 2
    Last Post: 04-05-2004, 08:06 PM
  5. which parser to use?
    By Ruchikar in forum Windows Programming
    Replies: 0
    Last Post: 07-25-2002, 02:02 AM

Tags for this Thread