You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Alfredo Muñoz <am...@eversystems.com> on 2001/02/06 00:17:02 UTC

Behavior when error& event handler occurs at the same Tag


I was surprised with the behavior of SAX Xerces-C 1.3 when
two events (error and endElement in my case) occurs at the same tag.
Was clever to me that the error event should be attended first, but
surprisingly It is
NOT the behavior, first is attended the endElement() event.

For example,  a validating parser whit the following valid XML:

<people>
	<name> Jhon </name>
	<lastName> Tom </lastName>
</people>

if the <lastName> tag is missing:

<people>
	<name> Jhon </name>
</people>

The error Handler error() arise in the </people> TAG as well as the
endElement() event handler
But the parser attend FIRST the endElement(), so if you need to do something
in error() BEFORE
the endElement() you are in troubles ( just my case  ;-)  ) and need to
change the app logic.

Let´s state that for my application a validation error() Is NOT a fatalError
so the parser must still go through the
end of the document.


Has Somebody  around there had the same problem, It is the way that
everybody think the parser should behave ?
Many thanks


Alfredo


RE: Behavior when error& event handler occurs at the same Tag

Posted by Alfredo Muñoz <am...@eversystems.com>.
Hi Folks,
Thanks for the answer.
I do not want to go through a discussion of what is important and what Is
not.
For me ( I think that almost everybody agree about that) an error event
should have more priority that every other event type, This is the way that
vast majority of callbacks - event handlers software runs out there.
So if both events arise at the same Tag (from an user point of view...) the
error event should be attended first.
If a design consideration was made an a enormous redesign must be done I
agree that it is not the very
first task to do.

Many thanks
Alfredo

-----Original Message-----
From: Michael Nigbor [mailto:michael.nigbor@riolabs.com]
Sent: Lunes, 05 de Febrero de 2001 08:40 p.m.
To: xerces-c-dev@xml.apache.org
Subject: RE: Behavior when error& event handler occurs at the same Tag


This behavior in not very important to me.  One vote to leave it alone from
this neck of the woods.

-----Original Message-----
From: Dean Roddey [mailto:droddey@charmedquark.com]
Sent: Monday, February 05, 2001 5:18 PM
To: xerces-c-dev@xml.apache.org
Subject: Re: Behavior when error& event handler occurs at the same Tag


I didn't really consider it heavily, I admit. I probably did them in the
order that was most efficient from the flow of the code. But, if there is a
consensus that it would be better to go the other way, I wouldn't argue.
Part of the deal is in the holding of information. I have to have scanned
the end tag before I can know that the content model of that tag was bad.
Because of the use of a pool of buffers to hold such data, and a desire not
to create more of them than required, I probably just tended to report
things as soon as they were determined, in order to free those buffers for
subsequent use.

--------------------------
Dean Roddey
The CIDLib C++ Frameworks
Charmed Quark Software
droddey@charmedquark.com
http://www.charmedquark.com

"We're gonna need a bigger boat"


----- Original Message -----
From: "Alfredo Muñoz" <am...@eversystems.com>
To: <xe...@xml.apache.org>
Sent: Monday, February 05, 2001 3:17 PM
Subject: Behavior when error& event handler occurs at the same Tag


>
>
> I was surprised with the behavior of SAX Xerces-C 1.3 when
> two events (error and endElement in my case) occurs at the same tag.
> Was clever to me that the error event should be attended first, but
> surprisingly It is
> NOT the behavior, first is attended the endElement() event.
>
> For example,  a validating parser whit the following valid XML:
>
> <people>
> <name> Jhon </name>
> <lastName> Tom </lastName>
> </people>
>
> if the <lastName> tag is missing:
>
> <people>
> <name> Jhon </name>
> </people>
>
> The error Handler error() arise in the </people> TAG as well as the
> endElement() event handler
> But the parser attend FIRST the endElement(), so if you need to do
something
> in error() BEFORE
> the endElement() you are in troubles ( just my case  ;-)  ) and need to
> change the app logic.
>
> Let´s state that for my application a validation error() Is NOT a
fatalError
> so the parser must still go through the
> end of the document.
>
>
> Has Somebody  around there had the same problem, It is the way that
> everybody think the parser should behave ?
> Many thanks
>
>
> Alfredo
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org



RE: Behavior when error& event handler occurs at the same Tag

Posted by Michael Nigbor <mi...@riolabs.com>.
This behavior in not very important to me.  One vote to leave it alone from
this neck of the woods.

-----Original Message-----
From: Dean Roddey [mailto:droddey@charmedquark.com]
Sent: Monday, February 05, 2001 5:18 PM
To: xerces-c-dev@xml.apache.org
Subject: Re: Behavior when error& event handler occurs at the same Tag


I didn't really consider it heavily, I admit. I probably did them in the
order that was most efficient from the flow of the code. But, if there is a
consensus that it would be better to go the other way, I wouldn't argue.
Part of the deal is in the holding of information. I have to have scanned
the end tag before I can know that the content model of that tag was bad.
Because of the use of a pool of buffers to hold such data, and a desire not
to create more of them than required, I probably just tended to report
things as soon as they were determined, in order to free those buffers for
subsequent use.

--------------------------
Dean Roddey
The CIDLib C++ Frameworks
Charmed Quark Software
droddey@charmedquark.com
http://www.charmedquark.com

"We're gonna need a bigger boat"


----- Original Message -----
From: "Alfredo Muñoz" <am...@eversystems.com>
To: <xe...@xml.apache.org>
Sent: Monday, February 05, 2001 3:17 PM
Subject: Behavior when error& event handler occurs at the same Tag


>
>
> I was surprised with the behavior of SAX Xerces-C 1.3 when
> two events (error and endElement in my case) occurs at the same tag.
> Was clever to me that the error event should be attended first, but
> surprisingly It is
> NOT the behavior, first is attended the endElement() event.
>
> For example,  a validating parser whit the following valid XML:
>
> <people>
> <name> Jhon </name>
> <lastName> Tom </lastName>
> </people>
>
> if the <lastName> tag is missing:
>
> <people>
> <name> Jhon </name>
> </people>
>
> The error Handler error() arise in the </people> TAG as well as the
> endElement() event handler
> But the parser attend FIRST the endElement(), so if you need to do
something
> in error() BEFORE
> the endElement() you are in troubles ( just my case  ;-)  ) and need to
> change the app logic.
>
> Let´s state that for my application a validation error() Is NOT a
fatalError
> so the parser must still go through the
> end of the document.
>
>
> Has Somebody  around there had the same problem, It is the way that
> everybody think the parser should behave ?
> Many thanks
>
>
> Alfredo
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org




Re: Behavior when error& event handler occurs at the same Tag

Posted by Dean Roddey <dr...@charmedquark.com>.
I didn't really consider it heavily, I admit. I probably did them in the
order that was most efficient from the flow of the code. But, if there is a
consensus that it would be better to go the other way, I wouldn't argue.
Part of the deal is in the holding of information. I have to have scanned
the end tag before I can know that the content model of that tag was bad.
Because of the use of a pool of buffers to hold such data, and a desire not
to create more of them than required, I probably just tended to report
things as soon as they were determined, in order to free those buffers for
subsequent use.

--------------------------
Dean Roddey
The CIDLib C++ Frameworks
Charmed Quark Software
droddey@charmedquark.com
http://www.charmedquark.com

"We're gonna need a bigger boat"


----- Original Message -----
From: "Alfredo Muñoz" <am...@eversystems.com>
To: <xe...@xml.apache.org>
Sent: Monday, February 05, 2001 3:17 PM
Subject: Behavior when error& event handler occurs at the same Tag


>
>
> I was surprised with the behavior of SAX Xerces-C 1.3 when
> two events (error and endElement in my case) occurs at the same tag.
> Was clever to me that the error event should be attended first, but
> surprisingly It is
> NOT the behavior, first is attended the endElement() event.
>
> For example,  a validating parser whit the following valid XML:
>
> <people>
> <name> Jhon </name>
> <lastName> Tom </lastName>
> </people>
>
> if the <lastName> tag is missing:
>
> <people>
> <name> Jhon </name>
> </people>
>
> The error Handler error() arise in the </people> TAG as well as the
> endElement() event handler
> But the parser attend FIRST the endElement(), so if you need to do
something
> in error() BEFORE
> the endElement() you are in troubles ( just my case  ;-)  ) and need to
> change the app logic.
>
> Let´s state that for my application a validation error() Is NOT a
fatalError
> so the parser must still go through the
> end of the document.
>
>
> Has Somebody  around there had the same problem, It is the way that
> everybody think the parser should behave ?
> Many thanks
>
>
> Alfredo
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>