Annotation of parser3/tests/149.html, revision 1.5
1.4 misha 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">
1.5 ! misha 6: <man first:attrname="attr value">
1.4 misha 7: <name>ПИФ^taint[&]</name>
1.5 ! misha 8: </man>
1.4 misha 9: <man id="1" имя="word слово">
10: <name>P«^;AF B</name>
11: <tst:findme xmlns:tst="http://parser.ru/tst">secret</tst:findme>
12: </man>
13: </people>
14: }]
15:
16: ^dump[Origin;$xdoc]
17:
18:
19: ^xdoc.documentElement.firstChild.nextSibling.getAttributeNS[http://parser.ru/first;attrname]
20: ^xdoc.documentElement.lastChild.previousSibling.setAttributeNS[http://parser.ru/second;second:attrname2;value 2]
21:
22: ^dump[Added attrname2 for last 'man' element;$xdoc]
23:
24:
25: ^xdoc.documentElement.firstChild.nextSibling.removeAttributeNS[http://parser.ru/first;attrname]
26:
27: ^dump[Removed attrname for first 'man' element;$xdoc]
28:
29:
30: ^^x.getAttrinuteNS[...;attrname2]='^xdoc.documentElement.lastChild.previousSibling.getAttributeNS[http://parser.ru/second;attrname2]'<br />
31: $Attr[^xdoc.documentElement.lastChild.previousSibling.getAttributeNodeNS[http://parser.ru/second;attrname2]]
32: ^$Attr.nodeValue='$Attr.nodeValue'<br />
33: $Attr.nodeValue[changed attribute value]
34:
35: ^dump[Changed attrname2 for last 'man' element;$xdoc]
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]]
41: ^if($oldAttr is xnode){wrong;right}<br />
42: $newAttr.nodeValue[value3]
43:
44: ^dump[Added attrname3 for last 'man' element;$xdoc]
45:
46:
47: $NodeList[^xdoc.getElementsByTagNameNS[http://parser.ru/tst;findme]]
48: ^show_xnodes1[$NodeList]<br /><br />
49:
50: $man1[^xdoc.selectSingle[/people/man[@id=1]]]
51: ^if(^man1.hasAttribute[id]){right;wrong2!}<br />
52: ^if(^man1.hasAttributeNS[http://parser.ru/third;attrname3]){right;wrong3}
53:
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: @dump[sTitle;xdoc]
61: ^if(def $sTitle){<h2>$sTitle</h2>}
62: ^show_xdoc2[$xdoc]<hr />
63: ^show_xnode1[$xdoc]<hr />
64: <hr />
65:
66: @show1[array][i;x;pattributes]
67: ^for[i](0;$array-1){
68: $x[$array.$i]
69: $x.firstChild.nodeValue:
70: $pattributes[$x.parentNode.attributes]
71: ^if(^pattributes._count[]){
72: $pattributes.id.name=$pattributes.id.nodeValue
73: }
74: <br />
75: }
76:
77: @show_xnodes1[array][i]
78: ^for[i](0;^array._count[]-1){
79: ^show_xnode1[$array.$i;0;1]
80: }
81:
82: @show_xnode1[x;level;single][l;pairs;names]
83: ^if(def $x){
84: ^for[l](0;$level-1){ ^; ^; ^; ^;}
85: ^if($x.nodeType == $xnode:ELEMENT_NODE){
86: <^;$x.nodeName
87: $pairs[$x.attributes]
88: ^if(def $pairs){
89: $names[^pairs._keys[]]
90: ^names.menu{ $names.key="$pairs.[$names.key].nodeValue"}
91: }
92: >^;
93: }{
94: [$x.nodeType]
95: }
96:
97: ^if(def $x.nodeValue){$x.nodeValue}<br />
98: ^show_xnode1[$x.firstChild]($level+1)
99: ^if(!$single){
100: ^show_xnode1[$x.nextSibling]($level)
101: }
102:
103: ^if($x.nodeType == $xnode:ELEMENT_NODE){
104: ^for[l](0;$level-1){ ^; ^; ^; ^;}<^;/$x.nodeName>^;<br />
105: }
106: }
107:
108: @show_xdoc2[xdoc]
109: #$response:body[^xdoc.file[ $.media-type[text/paf] ]]
110: <pre>^taint[html][^xdoc.string[
111: # $.method[html]
112: # $.encoding[utF-8]
113: # $.omit-xml-declaration[yes]
114: # $.standalone[no]
115: # -$.doctype-public[-//W3C//DTD XHTML]
116: # -$.doctype-system[/a/b/c/]
117: # $.indent[yes]
118: # $.media-type[text/paf]
119: ]]
120: </pre>
E-mail: