scew-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[scew-users] Regarding issue when using Stream parser


From: Anup Rao
Subject: [scew-users] Regarding issue when using Stream parser
Date: Mon, 13 Sep 2010 07:48:35 -0700

Hi Alex,

Following some of the changes suggested in the previous mail, I was able to 
parse data as required. However, I have come across a strange problem when 
using the stream parser. In relation to the split chunks that I was trying to 
handle, I have observed a difference in behavior.

If Portion A is '<chunk><n v="0"/><n ' and, portion B is 'v="0"/></chunk>', 
then the stream parsing succeeds.

If Portion A is '<chunk><n v="0"/><n' and, portion B is ' v="0"/></chunk>', 
then the stream parsing fails reporting expat error (Invalid token).

The position of the SPACE character seems to affect the behavior. I have 
attached a simple example to demonstrate the issue. The issue is reported as an 
expat error, I hope you can throw some light on the matter. Kindly let me know 
your thoughts on the issue.

Regards,
Anup


-----Original Message-----
From: Aleix Conchillo Flaqué [mailto:address@hidden On Behalf Of Aleix 
Conchillo Flaqué
Sent: Saturday, September 11, 2010 4:37 AM
To: Anup Rao; address@hidden
Subject: Re: Regarding usage of SCEW

Hello,

it's ok to contact me directly, but I think is better to use the mailing
lists so other users can look at it (or search through internet). So,
I'm forwarding this message to the mailing list (if you don't mind,
please subscribe).

I think I would concatenate your two chunks in one (but I don't know
where your data comes from). And then, simply do:

     pParser = scew_parser_create ();
     scew_parser_set_element_hook (pParser, element_hook_ , NULL);
     pReader = scew_reader_buffer_create((XML_Char const *)fullBuffer,
sizeof(fullBuffer));
     scew_parser_load_stream(pParser, pReader);

Then, element_hook_ would be called each time an element is parsed (e.g.
<n v=...>).

In your example, you are re-using the pParser twice and you are cheating
with the pReader by strcpying pBuf1 and pBuf2. And that's not a very
clean way to do things.

The important issue is how your XML data is being received. Where pBuf1
and pBuf2 come from? Can you concatenate them? It is also possible to
create your own SCEW reader, you only need to implement a few functions.


Aleix


On 09/10/2010 04:58 PM, Anup Rao wrote:
> Hi Aleix,
>
> My name I Anup Jayapal Rao. I work for Prysm Inc. I has contacted you earlier 
> with regard to the license terms of SCEW.
> I am trying out the stream parser in SCEW and facing an issue. I did not find 
> any forum(s) for SCEW and hence considered mailing you directly.
> Kindly forgive me if e-mail is not the right channel.
>
> I am posting the problem with a sample attachment. Suggestions to this will 
> give me a better understanding of SCEW.
>
> =8<============================================================================================================
>
> Problem: Let us assume that I receive an xml tree in two portions.
>
> Portion A is '<chunk><n v="0"/><n'
> And, portion B is 'v="0"/></chunk>'
>
> How must I setup SCEW to parse this split xml tree?
> The easiest way is to join the chunks and parse. However, my current need is 
> to execute an element hook for the first occurrence
> of '<n v="0"/>' as soon as it arrives and execute the element hook for the 
> second'<n v="0"/>' when it arrives later.
>
> =8<============================================================================================================
>
> I feel my understanding of SCEW is not strong. Kindly look at the simple c 
> code attached for the above mentioned example.
> Your suggestions will be very much appreciated.
>
> Regards,
> Anup
>
>
>
>
>
>
> -----Original Message-----
> From: address@hidden [mailto:address@hidden On Behalf Of Aleix Conchillo 
> Flaqué
> Sent: Thursday, January 28, 2010 3:04 PM
> To: Anup Rao
> Cc: Peter Ullmann; Venkatesan Ramamoorthy
> Subject: Re: Regarding usage of SCEW
>
> Hello Anup,
>
> I'm glad you use SCEW for your software. Here the answers:
>
> 1. Yes, you can link it statically.
>
> 2. Does not apply because answer to 1.
>
> 3. No, you don't need to publish SCEW source code, but you need to add
> a notice that SCEW is being used in your software and that SCEW is
> covered by the LGPL license, and also provide a copy of the LGPL
> license (v2.1).
>
> I'm not an expert on software licenses, if you have any further
> questions you can contact the FSF:
>
> http://www.fsf.org/licensing/contact
>
> Best regards,
>
> Aleix
>
> On Thu, Jan 28, 2010 at 06:29, Anup Rao<address@hidden>  wrote:
>> Hi Aleix,
>>
>>
>>
>> My name is Anup Jayapal Rao. I work for Prysm Inc.
>>
>> We use numerous open source components and would like to be compliant with
>> their respective licenses.
>>
>> I develop a software component for our Linux based embedded solution which
>> uses the SCEW library.
>>
>> We build the SCEW component as is to generate the “.A” file and statically
>> link to it.
>>
>> We make no changes to the SCEW library or the makefiles involved in the
>> build procedure.
>>
>>
>>
>> As the license is LGPL, we at Prysm felt it was best to clarify its usage
>> and licensing from you.
>>
>> As the author of the SCEW library, kindly let us know the following:
>>
>> 1>      Are we allowed to use the library as described above?
>>
>> 2>      If not, are we permitted to make a shared library by modifying the
>> makefile and then use it ?
>>
>> 3>      Do we need to publish the source code even though we make no changes
>> to SCEW?
>>
>>
>>
>> With Kind Regards,
>>
>> Anup Jayapal Rao
>>

CONFIDENTIAL COMMUNICATION -- The information in this e-mail (including any 
attachments) is confidential and proprietary to PRYSM, INC. and intended only 
for the sole use of the intended recipient.   If you have received this 
communication in error, then any review, dissemination, distribution, or 
copying of this message is strictly prohibited, and please permanently delete 
this message (including any copies of this e-mail and any attachments thereto) 
and notify us immediately by return e-mail or by forwarding this email to Susan 
Kent at address@hidden

Attachment: main.c
Description: main.c


reply via email to

[Prev in Thread] Current Thread [Next in Thread]