Annotation of parser3/tests/149.html, revision 1.2

1.1       paf         1: @main[]
                      2: $xdoc[^xdoc::create{<?xml version="1.0" encoding="$request:charset"?>
                      3: <!DOCTYPE people>
                      4: <!--some comment-->
                      5: <people xmlns:first="http://parser.ru/first" xmlns:second="http://parser.ru/second">
                      6:                <man first:attrname="attr value">
                      7:             <name>ПИФ^taint[&]</name>
                      8:                </man>
                      9:        <man id="1" имя="word слово">
                     10:                <name>P&#171^;AF        B</name>
                     11:                <tst:findme xmlns:tst="http://parser.ru/tst">secret</tst:findme>
                     12:        </man>
                     13: </people>
                     14: }]
                     15: 
1.2     ! misha      16: ^dump[Origin;$xdoc]
        !            17: 
1.1       paf        18: 
                     19: ^xdoc.documentElement.firstChild.nextSibling.getAttributeNS[http://parser.ru/first;attrname]
1.2     ! misha      20: ^xdoc.documentElement.lastChild.previousSibling.setAttributeNS[http://parser.ru/second;second:attrname2;value 2]
1.1       paf        21: 
1.2     ! misha      22: ^dump[Added attrname2 for last 'man' element;$xdoc]
1.1       paf        23: 
                     24: 
                     25: ^xdoc.documentElement.firstChild.nextSibling.removeAttributeNS[http://parser.ru/first;attrname]
                     26: 
1.2     ! misha      27: ^dump[Removed attrname for first 'man' element;$xdoc]
        !            28: 
1.1       paf        29: 
1.2     ! misha      30: ^^x.getAttrinuteNS[...;attrname2]='^xdoc.documentElement.lastChild.previousSibling.getAttributeNS[http://parser.ru/second;attrname2]'<br />
1.1       paf        31: $Attr[^xdoc.documentElement.lastChild.previousSibling.getAttributeNodeNS[http://parser.ru/second;attrname2]]
1.2     ! misha      32: ^$Attr.nodeValue='$Attr.nodeValue'<br />
1.1       paf        33: $Attr.nodeValue[changed attribute value]
                     34: 
1.2     ! misha      35: ^dump[Changed attrname2 for last 'man' element;$xdoc]
1.1       paf        36: 
                     37: 
                     38: #intentionally not predeclaring namespace. todo: think about that stuff
                     39: $newAttr[^xdoc.createAttributeNS[http://parser.ru/third;third:attrname3]]
                     40: $oldAttr[^xdoc.documentElement.lastChild.previousSibling.setAttributeNodeNS[$newAttr]]
1.2     ! misha      41: ^if($oldAttr is xnode){wrong;right}<br />
1.1       paf        42: $newAttr.nodeValue[value3]
                     43: 
1.2     ! misha      44: ^dump[Added attrname3 for last 'man' element;$xdoc]
        !            45: 
1.1       paf        46: 
                     47: $NodeList[^xdoc.getElementsByTagNameNS[http://parser.ru/tst;findme]]
1.2     ! misha      48: ^show_xnodes1[$NodeList]<br /><br />
1.1       paf        49: 
                     50: $man1[^xdoc.selectSingle[/people/man[@id=1]]]
1.2     ! misha      51: ^if(^man1.hasAttribute[id]){right;wrong2!}<br />
1.1       paf        52: ^if(^man1.hasAttributeNS[http://parser.ru/third;attrname3]){right;wrong3}
                     53: 
1.2     ! misha      54: <hr />
        !            55: 
        !            56: /people/man[@id=1] ^if(^man1.hasAttributes[]){has;hasn't} attributes<br />
        !            57: $name2[^xdoc.selectSingle[/people/man[@id=1]/name]]
        !            58: /people/man[@id=1]/name ^if(^name2.hasAttributes[]){has;hasn't} attributes<br />
        !            59: 
        !            60: 
1.1       paf        61: 
1.2     ! misha      62: @dump[sTitle;xdoc]
        !            63: ^if(def $sTitle){<h2>$sTitle</h2>}
        !            64: ^show_xdoc2[$xdoc]<hr />
        !            65: ^show_xnode1[$xdoc]<hr />
        !            66: <hr />
1.1       paf        67: 
1.2     ! misha      68: 
        !            69: 
        !            70: @show1[array][i;x;pattributes]
1.1       paf        71: ^for[i](0;$array-1){
                     72:     $x[$array.$i]
                     73:        $x.firstChild.nodeValue: 
                     74:                $pattributes[$x.parentNode.attributes]
                     75:                ^if(^pattributes._count[]){
                     76:                        $pattributes.id.name=$pattributes.id.nodeValue
                     77:                }
1.2     ! misha      78:        <br />
1.1       paf        79: }
1.2     ! misha      80: 
        !            81: 
1.1       paf        82:        
                     83: @show_xnodes1[array][i]
                     84: ^for[i](0;^array._count[]-1){
                     85:        ^show_xnode1[$array.$i;0;1]
                     86: }
                     87: 
1.2     ! misha      88: 
        !            89: 
        !            90: @show_xnode1[x;level;single][l;pairs;names]
1.1       paf        91: ^if(def $x){
                     92:     ^for[l](0;$level-1){&nbsp^;&nbsp^;&nbsp^;&nbsp^;}
                     93:     ^if($x.nodeType == $xnode:ELEMENT_NODE){
                     94:        &lt^;$x.nodeName
                     95:            $pairs[$x.attributes]
                     96:            ^if(def $pairs){
                     97:                $names[^pairs._keys[]]
                     98:                ^names.menu{ $names.key="$pairs.[$names.key].nodeValue"}
                     99:            }
                    100:            &gt^;
                    101:     }{
                    102:        [$x.nodeType]
                    103:     }
                    104:     
1.2     ! misha     105:     ^if(def $x.nodeValue){$x.nodeValue}<br />
1.1       paf       106:     ^show_xnode1[$x.firstChild]($level+1)
                    107:     ^if(!$single){
                    108:            ^show_xnode1[$x.nextSibling]($level)
                    109:     }
                    110: 
                    111:     ^if($x.nodeType == $xnode:ELEMENT_NODE){
1.2     ! misha     112:     ^for[l](0;$level-1){&nbsp^;&nbsp^;&nbsp^;&nbsp^;}&lt^;/$x.nodeName&gt^;<br />
1.1       paf       113:     }
                    114: }
                    115: 
1.2     ! misha     116: 
        !           117: 
1.1       paf       118: @show_xdoc2[xdoc]
                    119: #$response:body[^xdoc.file[    $.media-type[text/paf]  ]]
                    120: <pre>^taint[html][^xdoc.string[
                    121: #      $.method[html]
                    122: #      $.encoding[utF-8]
                    123: #      $.omit-xml-declaration[yes]
                    124: #      $.standalone[no]
                    125: #      -$.doctype-public[-//W3C//DTD XHTML]
                    126: #      -$.doctype-system[/a/b/c/]
                    127: #      $.indent[yes]
                    128: #      $.media-type[text/paf]
                    129: ]]
                    130: </pre>

E-mail: