Re: C14N 1.1 Appendix A [was: Minutes for XML Core WG telcon of 2007 October 24]

Konrad Lanz wrote:
> I think the easiest would be to take a completely different approach!
> Maybe something like:
> --------------------------------------------------------------------
>
> 1. Set a "path-absolute" flag if the input starts with a slash.
>
> 2. Take an empty stack and an empty buffer.
>
> 3.  while(not at the end of the input) {
>  
>   clear the buffer;
>
>   continue to scan the input from the left and append all non slash
>   characters to a temporary buffer (buf) until a slash is reached that was
>   preceded by a non slash character.
>
>   if (buf is '.'){
>    //ignore
>   } else if (buf is '..') {
>         if (stack is empty and not path-absolute) {
>           //start to accumulate complete '..' path segments to the left
>           push '..' onto the stack;
>         }else if (stack is empty and path-absolute) {
>           //ignore '..' path segments hitting the root;
>         }else if (stack-peek is '..') {
>            //stack is not empty is implied and continue to accumulate
>            //complete '..' path segments to the left
>           push '..' onto the stack;
>         } else {
>            //stack is not empty is implied so lets pop the the path
>            //segment to the left
>           pop the stack;
>         }
>   
   } else {

push buf's value onto the stack;

>   }
> }
>
> 4. Take the stack now as a slash sperated list with the peek as the last
>     element and prepend a slash if "path-absolute".
>
> 5. If the last character of the input was a  slash as well append a slash.
>
> 6. If the last path segment is  '..' and not already terminated by a
> slash append a slash as well.
>
> Enjoy, can someone else also try to get his head around this .... I'll
> test it in my implementation as soon as I have time.
>
> --------------------------------------------------------------------
>   


Can't just get it right the first time ... well let's see what others think.

-- 
Konrad Lanz, IAIK/SIC - Graz University of Technology
Inffeldgasse 16a, 8010 Graz, Austria
Tel: +43 316 873 5547
Fax: +43 316 873 5520
https://www.iaik.tugraz.at/aboutus/people/lanz
http://jce.iaik.tugraz.at

Certificate chain (including the EuroPKI root certificate):
https://europki.iaik.at/ca/europki-at/cert_download.htm

Received on Thursday, 25 October 2007 21:18:04 UTC