Results 1 to 3 of 3

Thread: parser

  1. #1
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default parser

    Ji,
    I must implement a descent recursive parser in C# that is based on a LL(1) grammar. I did it:
    Qt Code:
    1. Hello,
    2. I must implement a such parser (based on a LL(1) grammar). I did this
    3. try {
    4. // Create the reader.
    5. XmlReaderSettings settings = new XmlReaderSettings();
    6. settings.IgnoreWhitespace = true;
    7. XmlReader reader = XmlReader.Create(new XmlTextReader(filename), settings);
    8.  
    9. while (reader.Read()) {
    10. switch (reader.NodeType) {
    11. case XmlNodeType.Element:
    12. Hashtable attributes = new Hashtable();
    13. string strURI = reader.NamespaceURI;
    14. string strName = reader.Name;
    15. Console.Write(strURI + " " + "<" + strName );
    16. case XmlNodeType.XXXX
    17. .................................................
    18. }
    19. }
    To copy to clipboard, switch view to plain text mode 
    Can I say that using SAX I'm doing a recursive descent parser or not?
    thanks
    Regards

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: parser

    I think it depends how you use it. The above code is surely not descendent, it's linear. QXmlStreamReader has an example of a descendent parser.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: parser

    Hello,
    I think it's very complicated while I need something very simple. Do you know if instead SAX is recursive?
    COuld you send me the QTXML files as I can't install QT on this pc?
    thanks,
    Regards

Similar Threads

  1. XML parser problem
    By Cantora in forum Newbie
    Replies: 9
    Last Post: 5th June 2009, 13:13
  2. Parser
    By ComaWhite in forum General Programming
    Replies: 4
    Last Post: 29th October 2008, 00:22
  3. java parser
    By mickey in forum General Programming
    Replies: 13
    Last Post: 14th October 2008, 23:11
  4. Qt4 open src mingw from a PC to another
    By nvictor in forum Installation and Deployment
    Replies: 11
    Last Post: 1st May 2007, 18:41
  5. Parser in Qt.... HELP!
    By deepusrp in forum Newbie
    Replies: 6
    Last Post: 23rd January 2007, 22:18

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.