< Previous by Date Date Index Next by Date >
< Previous in Thread Thread Index  

Re: [reSIProcate-users] [ParseBuffer - error message during xml parsing]


The comment handling code never would have worked.  : )  I've commit a fix for the comment handling in XMLCursor to SVN.

Thanks,
Scott

On Tue, May 19, 2009 at 5:58 PM, Jean Grivel <jean1933@xxxxxxx> wrote:
A simple example would be to add a comment in one of the xml data used to test the
xml cursor. In the file testXMLCursor.cxx located in resip/stack/test, you can modify
the first xml data in this way:
const Data test(
         "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"
         "<presence xmlns=\"urn:ietf:params:xml:ns:pidf\"\r\n"
         "          xmlns:ep=\"urn:ietf:params:xml:ns:pidf:rpid:rpid-person\"\r\n"
         "          xmlns:pp=\"urn:ietf:params:xml:ns:pidf:person\"\r\n"
         "          entity=\"sip:chris@xxxxxxxxxxxxx\">\r\n"
         "  <pp:person>\r\n"
         "   <status>\r\n"
         "    <ep:activities>\r\n"
         "     <ep:activity>away</ep:activity>\r\n"
         "    </ep:activities>\r\n"
         "   </status>\r\n"
         "  </pp:person>\r\n"
         "  <tuple id=\"9b6yhF2Gk37o4\" >\r\n"
         "     <status><basic>open</basic></status>\r\n"
         "  </tuple>\r\n"
     "<!--foo-->"
         "</presence>");

The same problem will occur:

DEBUG | 20090519-235616.186 | testXMLCursor | RESIP | 3077678800 | BaseException.cxx:17 | BaseException at ParseBuffer.cxx:1058 dereferenced ParseBuffer eof

ParseException dereferenced ParseBuffer eof @ ParseBuffer.cxx:1058
testXMLCursor: testXMLCursor.cxx:74: int main(): Assertion `false' failed.

I am using resiprocate to simulate my UAS and I wanted to use the xml parser in resip because it enables to
parse xml data without storing this data into a file. That's why I use this parser.
Thanks for your help.




Date: Tue, 19 May 2009 13:28:58 -0700

Subject: Re: [reSIProcate-users] [ParseBuffer - error message during xml parsing]
From: derek.macdonald@xxxxxxxxx
To: sgodin@xxxxxxxxxxxxxxx
CC: jean1933@xxxxxxx; resiprocate-users@xxxxxxxxxxxxxxx


I would not recommend using xmlcursor for anything more than what is generated by resip; I called for deprecating it a while ago:) You are better off removing that from your build and using your own xml parsing library of choice.

-Derek

On Tue, May 19, 2009 at 12:57 PM, Scott Godin <sgodin@xxxxxxxxxxxxxxx> wrote:
A quick look at the code in XMLCursor.cxx indicates that is trying to handle comments.  However, the xml parser in resip is pretty basic - I don't think it even handles xml namespaces correctly.  There has been discussions in the past about deprecating it.  If you can post the XML body, then I can try and track this down further when I get a chance.  

Scott


On Tue, May 19, 2009 at 3:07 PM, Jean Grivel <jean1933@xxxxxxx> wrote:
Hi all,

I have found why the exception is thrown. It is because of a comment in the xml content.
 For example: <!-- foo -->.
Does the xml parser (xmlcursor) handle the comments in xml data ?

Thanks.


From: jean1933@xxxxxxx
To: sgodin@xxxxxxxxxxxxxxx
Date: Tue, 19 May 2009 17:27:54 +0200
Subject: Re: [reSIProcate-users] [ParseBuffer - error message during xml parsing]

Thanks for you answer. Actually it is a little difficult to explain.

I have a User Agent Server which receives from another entity, INFO SIP messages

with xml content.

In the UAS::onInfo(InviteSessionHandle is, const SipMessage& msg) function,

I extract the xml content:

Data xmlData = (msg.getContents())->getBodyData();

Then, I call the parser function:

parser(xmlData);

The code of this function looks like:

try

{

XMLCursor xmlc(ParseBuffer(xmlData.data(), xmlData.size()));

if (xmlc.getTag() == "foo")

{

traverse(xmlc);

…..

}

}

catch (ParseException& e)

{

cerr << e << endl;

assert(false);

}

The traverse function is like this one:

this->process(c);

if (c.firstChild())

{

process(c);

c.parent();

}

if (c.nextSibling())

{

process(c);

}

My problem is about an exception thrown in the parser function and also the assertion which fails.




Date: Tue, 19 May 2009 10:57:48 -0400
Subject: Re: [reSIProcate-users] [ParseBuffer - error message during xml parsing]
From: sgodin@xxxxxxxxxxxxxxx
To: jean1933@xxxxxxx
CC: resiprocate-users@xxxxxxxxxxxxxxx

There is not much to go on here.  Can you post a test program that shows this problem?

Scott

On Tue, May 19, 2009 at 10:47 AM, Jean Grivel <jean1933@xxxxxxx> wrote:

Hi all,

I use XMLCursor to parse xml content. My function is something like

parser (Data xmlData). This function is called about every second to parse


the xml data.

After 3 calls, I got this error:

ParseException dereferenced ParseBuffer eof @ ParseBuffer.cxx:1058

Please could you help me solving this problem ?

Thanks in adavance.



Discutez sur Messenger où que vous soyez ! Mettez Messenger sur votre mobile !

_______________________________________________
resiprocate-users mailing list
resiprocate-users@xxxxxxxxxxxxxxx
List Archive: http://list.resiprocate.org/archive/resiprocate-users/



Vous voulez savoir ce que vous pouvez faire avec le nouveau Windows Live ? Lancez-vous !

Discutez sur Messenger où que vous soyez ! Mettez Messenger sur votre mobile !


_______________________________________________
resiprocate-users mailing list
resiprocate-users@xxxxxxxxxxxxxxx
List Archive: http://list.resiprocate.org/archive/resiprocate-users/



Votre correspondant a choisi Hotmail et profite d’un stockage quasiment illimité. Créez un compte Hotmail gratuitement !