Long Descriptor problem

Login to reply to this topic.
Mon, 2007-12-03 09:40
Joined: 2007-11-12
Forum posts: 17

i'm trying to parse xml in a string that i obtain from bluetooth rfcomm. but im having problems. i tried using HBufC8* iXmlString to receive it as follows, but there's a problem.

Here is the code
void CXmlHandler::StartParsingL( const TDesC& aXmlString )
{
// Remember to cancel any outstanding request first.
if ( IsActive() )
{
Cancel();
}
iXmlString = HBufC8::NewL( aXmlString.Length());
*iXmlString = aXmlString;
iDisplayResult->Des().Zero();
SetActive();

iParser->ParseBeginL();
}

I get the error error C2679: binary '=' : no operator found which takes a right-hand operand of type 'const TDesC' (or there is no acceptable conversion)

any suggestions.


Mon, 2007-12-03 09:45
Joined: 2004-11-29
Forum posts: 1232
Re: Long Descriptor problem

HBufC8 is an 8 bit descriptor and TDesC is a 16 bit in default builds.

Try HBufC16 or TDesC8 (which depending on what you need)

Mon, 2007-12-03 10:13
Joined: 2007-11-12
Forum posts: 17
Re: Long Descriptor problem

Thanks for your reply. I solved the problem using TDesC8&. I successfully passed the iXmlString into the CParse::ParseL() method as shown below

void CXmlHandler::RunL()
{
    if ( KErrNone == iStatus.Int() )
     {
                        // If the string length is zero, it means if we have reached
                        // the end of the string.
                        if ( iXmlString->Length() == 0)
            {
                                iParser->ParseEndL();
                                delete iXmlString;
                                iXmlString = 0;
            }
                        else
                        {
                                // Parse the XML document.
                                iParser->ParseL( *iXmlString );
                                SetActive();
                        }
      }

    else
      {
                        iObserver.OnParseCompleted( iStatus.Int() );
      }
  }

When i run it i the applicaton hangs (nothing happens), am i missing something.

Mon, 2007-12-03 21:09
Joined: 2007-09-23
Forum posts: 159
Re: Long Descriptor problem

Its hanging because you're not passing your active objects iStatus to anything as far as I can see.

Wed, 2007-12-05 12:19
Joined: 2007-11-12
Forum posts: 17
Re: Long Descriptor problem

so what should i change so as to pass iStatus...im confused

Wed, 2007-12-05 12:52
Joined: 2004-11-29
Forum posts: 1232
Re: Long Descriptor problem

You need to re-issue the request in RunL, its not enough to just set it as active again.
That is what Numpty is talking about.

  • Login to reply to this topic.