×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Jul 2006
    Posts
    20

    XML parsing with with Xml::CParser - problems

    Hi, I want to parse and generate some XML and I have to use the Xml::CParser that comes with the series 60 3rd edition sdk, but I have come across some problems. Basicly, I can't find any decent documentation on this parser. Secondly, I've managed to write the fallowing sniplet of code (based on http://forum.nokia.com/main/technica...er_in_S60.htm), but the marked UHEAP_MARKEND invocation causes my program to panic with a "App. closed. Alloc" error. Also, commenting the lines with ParserBeginL and ParserEndL gives the same result.
    CContentHandler is my practically empty class implementing the MContentHandler interface.

    Could somebody help me with this or direct me to some verbose documentation of the parser?

    Also is it possible to generate xml using only classes delivered by symbian/series 60?

    Code:
    using Xml::CParser ;
    
    void testL ()
        {
        _LIT8(KParserMimeType, "text/xml") ;
        _LIT8(KXmlDoc, "<?xml version=\"1.0\" encoding=\"utf-8\" ?><test><foo></foo><bar /></test>") ;
        
        __UHEAP_MARK;
        
            CContentHandler* contentHanlder ;
            CParser* parser ;
        
            __UHEAP_MARK;
                contentHanlder = CContentHandler::NewLC () ;
                CleanupStack::PopAndDestroy (contentHanlder) ;
            __UHEAP_MARKEND;
        
            contentHanlder = CContentHandler::NewLC () ;
        
            __UHEAP_MARK;
                parser = CParser::NewLC (KParserMimeType, *contentHanlder) ;
                CleanupStack::PopAndDestroy (parser) ;
            __UHEAP_MARKEND;
        
            CleanupStack::PopAndDestroy (contentHanlder) ;
            contentHanlder = CContentHandler::NewLC () ;
            __UHEAP_MARK;
                parser = CParser::NewLC (KParserMimeType, *contentHanlder) ;
        
                parser->ParseBeginL() ;
                parser->ParseL (KXmlDoc) ;
                parser->ParseEndL() ;
                CleanupStack::Pop (parser) ;
                delete parser ;
            __UHEAP_MARKEND;  //// HERE
            CleanupStack::PopAndDestroy (contentHanlder) ;
        __UHEAP_MARKEND;
        }

  2. #2
    Registered User
    Join Date
    Jan 2006
    Posts
    18

    Re: XML parsing with with Xml::CParser - problems

    derieve a class from MContentHandler and override the functions of that class.
    a call to the Parse functions of CParser will invoke the overridden function OnStartElementL,OnEndElementL,OnContentL,etc

  3. #3
    Registered User
    Join Date
    Jul 2006
    Posts
    20

    Re: XML parsing with with Xml::CParser - problems

    Quote Originally Posted by jessyjane
    derieve a class from MContentHandler and override the functions of that class.
    a call to the Parse functions of CParser will invoke the overridden function OnStartElementL,OnEndElementL,OnContentL,etc
    Yes, I did that - as I wrote in the my first post:
    Quote Originally Posted by mka_bls
    CContentHandler is my practically empty class implementing the MContentHandler interface.
    I've implemented the MContentHandler and it's method are being invoked by the parser (I can see this in the debuger), so that works as expected, and it's not the case here.

  4. #4
    Registered User
    Join Date
    Jul 2006
    Posts
    20

    Re: XML parsing with with Xml::CParser - problems

    Ok, I managed to find the error - it was some debug code that I've put in my MContentHanlder implementation. I was using CAknInformationNote's ExecuteLD to display debug messages, but as it turns out, ExecuteLD doesn't destroy the note instantly, and that caused UHEAP_MARKEND to fail.

Similar Threads

  1. hi XML Parsing in Symbian
    By 22abhinav82 in forum Symbian
    Replies: 2
    Last Post: 2006-06-11, 09:21
  2. XML Parsing
    By jessyjane in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2006-04-24, 08:17
  3. XML parsing problem in Nokia 12
    By codekiller in forum Nokia M2M
    Replies: 2
    Last Post: 2005-04-26, 09:01
  4. About XML parsing!
    By wangyking in forum Symbian
    Replies: 3
    Last Post: 2005-01-19, 05:45
  5. About XML parsing!
    By wangyking in forum Symbian Tools & SDKs
    Replies: 2
    Last Post: 2004-05-26, 14:10

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×