Uploaded image for project: 'Axis2-C'
  1. Axis2-C
  2. AXIS2C-944

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



    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.3.0
    • Component/s: guththila
    • Labels:
    • Environment:
      Windows XP, Visual Studio 2005, guththila, libcurl


      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_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;


        1. diff.txt
          30 kB
          Bill Mitchell



            • Assignee:
              wtmitchell3 Bill Mitchell
              wtmitchell3 Bill Mitchell
            • Votes:
              0 Vote for this issue
              1 Start watching this issue


              • Created: