You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@axis.apache.org by "Bill Mitchell (JIRA)" <ji...@apache.org> on 2008/01/31 00:33:35 UTC

[jira] Created: (AXIS2C-944) guththila parser ignores XML scope rules on namespace declarations with the same prefix

guththila parser ignores XML scope rules on namespace declarations with the same prefix
---------------------------------------------------------------------------------------

                 Key: AXIS2C-944
                 URL: https://issues.apache.org/jira/browse/AXIS2C-944
             Project: Axis2-C
          Issue Type: Bug
          Components: guththila
    Affects Versions: Current (Nightly)
         Environment: Windows XP, Visual Studio 2005, guththila, libcurl
            Reporter: Bill Mitchell


The guththila parser looks for a match on the namespace prefix/URI from the outermost element inwards.  This violates the scope rules for XML namespaces, see http://www.w3.org/TR/REC-xml-names/.  This problem holds for both incoming messages in guththila_xml_parser.c and outgoing messages in guththila_xml_writer.c.  Essentially every loop involving guththila_stack_get_by_index() is suspect, and either needs to start at (stack_size - 1) and go backwards, or fetch the namespace at the (stack_size - 1 - i)  index.  

I uncovered this by inspection, not by testing, so there is some chance that my understanding is incorrect.  But I looked at guththila_stack.c and indeed for index 0 it returns the outermost/first element pushed, so there is no tricky logic there to get the stack in the other order.  Of course, one could indeed fix this problem by changing guththila_stack_get_by_index() to return the elements from the innermost/most recently pushed back out to the outermost.  This would be the easiest fix to make, and the safest in that it would not change the logic in any of the existing loops, although it would seem less clear to the casual reader.  

In other words, the current logic:

guththila_stack_get_by_index(
    guththila_stack_t * stack,
    int index,
    const axutil_env_t * env) 
{
    return index < stack->top ? stack->data[index] : NULL;
} 

could be changed to read:
{
    return index < stack->top ? stack->data[stack->top - index - 1] : NULL;
} 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Resolved: (AXIS2C-944) guththila parser ignores XML scope rules on namespace declarations with the same prefix

Posted by "Bill Mitchell (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2C-944?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bill Mitchell resolved AXIS2C-944.
----------------------------------

    Resolution: Fixed
      Assignee: Bill Mitchell

This fix has been applied as svn rev 618521.

> guththila parser ignores XML scope rules on namespace declarations with the same prefix
> ---------------------------------------------------------------------------------------
>
>                 Key: AXIS2C-944
>                 URL: https://issues.apache.org/jira/browse/AXIS2C-944
>             Project: Axis2-C
>          Issue Type: Bug
>          Components: guththila
>    Affects Versions: Current (Nightly)
>         Environment: Windows XP, Visual Studio 2005, guththila, libcurl
>            Reporter: Bill Mitchell
>            Assignee: Bill Mitchell
>             Fix For: 1.3.0
>
>         Attachments: diff.txt
>
>
> The guththila parser looks for a match on the namespace prefix/URI from the outermost element inwards.  This violates the scope rules for XML namespaces, see http://www.w3.org/TR/REC-xml-names/.  This problem holds for both incoming messages in guththila_xml_parser.c and outgoing messages in guththila_xml_writer.c.  Essentially every loop involving guththila_stack_get_by_index() is suspect, and either needs to start at (stack_size - 1) and go backwards, or fetch the namespace at the (stack_size - 1 - i)  index.  
> I uncovered this by inspection, not by testing, so there is some chance that my understanding is incorrect.  But I looked at guththila_stack.c and indeed for index 0 it returns the outermost/first element pushed, so there is no tricky logic there to get the stack in the other order.  Of course, one could indeed fix this problem by changing guththila_stack_get_by_index() to return the elements from the innermost/most recently pushed back out to the outermost.  This would be the easiest fix to make, and the safest in that it would not change the logic in any of the existing loops, although it would seem less clear to the casual reader.  
> In other words, the current logic:
> guththila_stack_get_by_index(
>     guththila_stack_t * stack,
>     int index,
>     const axutil_env_t * env) 
> {
>     return index < stack->top ? stack->data[index] : NULL;
> } 
> could be changed to read:
> {
>     return index < stack->top ? stack->data[stack->top - index - 1] : NULL;
> } 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Updated: (AXIS2C-944) guththila parser ignores XML scope rules on namespace declarations with the same prefix

Posted by "Dinesh Premalal (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2C-944?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dinesh Premalal updated AXIS2C-944:
-----------------------------------

    Fix Version/s: 1.3.0

> guththila parser ignores XML scope rules on namespace declarations with the same prefix
> ---------------------------------------------------------------------------------------
>
>                 Key: AXIS2C-944
>                 URL: https://issues.apache.org/jira/browse/AXIS2C-944
>             Project: Axis2-C
>          Issue Type: Bug
>          Components: guththila
>    Affects Versions: Current (Nightly)
>         Environment: Windows XP, Visual Studio 2005, guththila, libcurl
>            Reporter: Bill Mitchell
>             Fix For: 1.3.0
>
>
> The guththila parser looks for a match on the namespace prefix/URI from the outermost element inwards.  This violates the scope rules for XML namespaces, see http://www.w3.org/TR/REC-xml-names/.  This problem holds for both incoming messages in guththila_xml_parser.c and outgoing messages in guththila_xml_writer.c.  Essentially every loop involving guththila_stack_get_by_index() is suspect, and either needs to start at (stack_size - 1) and go backwards, or fetch the namespace at the (stack_size - 1 - i)  index.  
> I uncovered this by inspection, not by testing, so there is some chance that my understanding is incorrect.  But I looked at guththila_stack.c and indeed for index 0 it returns the outermost/first element pushed, so there is no tricky logic there to get the stack in the other order.  Of course, one could indeed fix this problem by changing guththila_stack_get_by_index() to return the elements from the innermost/most recently pushed back out to the outermost.  This would be the easiest fix to make, and the safest in that it would not change the logic in any of the existing loops, although it would seem less clear to the casual reader.  
> In other words, the current logic:
> guththila_stack_get_by_index(
>     guththila_stack_t * stack,
>     int index,
>     const axutil_env_t * env) 
> {
>     return index < stack->top ? stack->data[index] : NULL;
> } 
> could be changed to read:
> {
>     return index < stack->top ? stack->data[stack->top - index - 1] : NULL;
> } 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Updated: (AXIS2C-944) guththila parser ignores XML scope rules on namespace declarations with the same prefix

Posted by "Bill Mitchell (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2C-944?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bill Mitchell updated AXIS2C-944:
---------------------------------

    Attachment: diff.txt

The attached diff contains changes to conform to the XML namespace scope rules by searching the namespace stack from the inside out.  

As well, having enabled warning messages in the Windows NMAKE makefile, I have fixed several mismatched signed/unsigned conflicts that the compiler diagnosed.  And the relatively new guththila_token_close routines were moved intact after the expected first entry points of create/init/free.  

> guththila parser ignores XML scope rules on namespace declarations with the same prefix
> ---------------------------------------------------------------------------------------
>
>                 Key: AXIS2C-944
>                 URL: https://issues.apache.org/jira/browse/AXIS2C-944
>             Project: Axis2-C
>          Issue Type: Bug
>          Components: guththila
>    Affects Versions: Current (Nightly)
>         Environment: Windows XP, Visual Studio 2005, guththila, libcurl
>            Reporter: Bill Mitchell
>             Fix For: 1.3.0
>
>         Attachments: diff.txt
>
>
> The guththila parser looks for a match on the namespace prefix/URI from the outermost element inwards.  This violates the scope rules for XML namespaces, see http://www.w3.org/TR/REC-xml-names/.  This problem holds for both incoming messages in guththila_xml_parser.c and outgoing messages in guththila_xml_writer.c.  Essentially every loop involving guththila_stack_get_by_index() is suspect, and either needs to start at (stack_size - 1) and go backwards, or fetch the namespace at the (stack_size - 1 - i)  index.  
> I uncovered this by inspection, not by testing, so there is some chance that my understanding is incorrect.  But I looked at guththila_stack.c and indeed for index 0 it returns the outermost/first element pushed, so there is no tricky logic there to get the stack in the other order.  Of course, one could indeed fix this problem by changing guththila_stack_get_by_index() to return the elements from the innermost/most recently pushed back out to the outermost.  This would be the easiest fix to make, and the safest in that it would not change the logic in any of the existing loops, although it would seem less clear to the casual reader.  
> In other words, the current logic:
> guththila_stack_get_by_index(
>     guththila_stack_t * stack,
>     int index,
>     const axutil_env_t * env) 
> {
>     return index < stack->top ? stack->data[index] : NULL;
> } 
> could be changed to read:
> {
>     return index < stack->top ? stack->data[stack->top - index - 1] : NULL;
> } 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (AXIS2C-944) guththila parser ignores XML scope rules on namespace declarations with the same prefix

Posted by "Bill Mitchell (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2C-944?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12564444#action_12564444 ] 

Bill Mitchell commented on AXIS2C-944:
--------------------------------------

Looking at the code in more detail, I see that guththila_xml_writer examines the namespace 7 times from the outermost to the innermost, and twice the correct way from the innermost to the outermost.  All two times that guththila_xml_parser.c examines the namespace stack, it does it from the outermost to the innermost, i.e., in the wrong order.

guththila_get_namespace_prefix_by_number(), guththila_get_namespace_uri_by_number() makes the use of the number visible to the caller.  These are used by the guththila_main sample program, and interestingly use 1-origin indexing.  

guththila_get_attribute_XXX_by_number() uses the same stack routines, so the stack construct is not used just for namespaces.  As with the guththila_get_namespace_XXX_by_number() routines, these are used by the guththila_main sample program and use 1-origin indexing.

Given the additional interface routines that make the numbering scheme visible publicly, the right solution appears to be to fix the offending loops in guththila_xml_parser.c and guththila_xml_writer.c to examine the stack from the higher index down to zero.  Not the "clever" solution to number the stack from the top of the stack backwards.  

> guththila parser ignores XML scope rules on namespace declarations with the same prefix
> ---------------------------------------------------------------------------------------
>
>                 Key: AXIS2C-944
>                 URL: https://issues.apache.org/jira/browse/AXIS2C-944
>             Project: Axis2-C
>          Issue Type: Bug
>          Components: guththila
>    Affects Versions: Current (Nightly)
>         Environment: Windows XP, Visual Studio 2005, guththila, libcurl
>            Reporter: Bill Mitchell
>
> The guththila parser looks for a match on the namespace prefix/URI from the outermost element inwards.  This violates the scope rules for XML namespaces, see http://www.w3.org/TR/REC-xml-names/.  This problem holds for both incoming messages in guththila_xml_parser.c and outgoing messages in guththila_xml_writer.c.  Essentially every loop involving guththila_stack_get_by_index() is suspect, and either needs to start at (stack_size - 1) and go backwards, or fetch the namespace at the (stack_size - 1 - i)  index.  
> I uncovered this by inspection, not by testing, so there is some chance that my understanding is incorrect.  But I looked at guththila_stack.c and indeed for index 0 it returns the outermost/first element pushed, so there is no tricky logic there to get the stack in the other order.  Of course, one could indeed fix this problem by changing guththila_stack_get_by_index() to return the elements from the innermost/most recently pushed back out to the outermost.  This would be the easiest fix to make, and the safest in that it would not change the logic in any of the existing loops, although it would seem less clear to the casual reader.  
> In other words, the current logic:
> guththila_stack_get_by_index(
>     guththila_stack_t * stack,
>     int index,
>     const axutil_env_t * env) 
> {
>     return index < stack->top ? stack->data[index] : NULL;
> } 
> could be changed to read:
> {
>     return index < stack->top ? stack->data[stack->top - index - 1] : NULL;
> } 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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