|
|
| version 1.1, 2005/12/19 12:24:57 | version 1.3, 2010/07/25 06:14:46 |
|---|---|
| Line 1 | Line 1 |
| @main[] | @main[] |
| $xdoc[^xdoc::create{<?xml version="1.0" encoding="$request:charset"?> | $xdoc[^xdoc::create{<?xml version="1.0" encoding="$request:charset"?> |
| <!DOCTYPE people> | <!DOCTYPE people> |
| <!--some comment--> | <!--some comment--> |
| <people xmlns:first="http://parser.ru/first" xmlns:second="http://parser.ru/second"> | <people xmlns:first="http://parser.ru/first" xmlns:second="http://parser.ru/second"> |
| <man first:attrname="attr value"> | <man first:attrname="attr value"> |
| <name>ПИФ^taint[&]</name> | <name>ПИФ^taint[&]</name> |
| </man> | </man> |
| <man id="1" имя="word слово"> | <man id="1" имя="word слово"> |
| <name>P«^;AF B</name> | <name>P«^;AF B</name> |
| <tst:findme xmlns:tst="http://parser.ru/tst">secret</tst:findme> | <tst:findme xmlns:tst="http://parser.ru/tst">secret</tst:findme> |
| </man> | </man> |
| </people> | </people> |
| }] | }] |
| ^dump[$xdoc] | ^dump[Origin;$xdoc] |
| ^xdoc.documentElement.firstChild.nextSibling.getAttributeNS[http://parser.ru/first;attrname] | |
| ^xdoc.documentElement.firstChild.nextSibling.getAttributeNS[http://parser.ru/first;attrname] | |
| ^xdoc.documentElement.lastChild.previousSibling.setAttributeNS[http://parser.ru/second;second:attrname2;value 2] | ^xdoc.documentElement.lastChild.previousSibling.setAttributeNS[http://parser.ru/second;second:attrname2;value 2] |
| ^dump[$xdoc] | ^dump[Added attrname2 for last 'man' element;$xdoc] |
| ^xdoc.documentElement.firstChild.nextSibling.removeAttributeNS[http://parser.ru/first;attrname] | |
| ^xdoc.documentElement.firstChild.nextSibling.removeAttributeNS[http://parser.ru/first;attrname] | |
| ^dump[$xdoc] | |
| ^dump[Removed attrname for first 'man' element;$xdoc] | |
| =^xdoc.documentElement.lastChild.previousSibling.getAttributeNS[http://parser.ru/second;attrname2]= | |
| $Attr[^xdoc.documentElement.lastChild.previousSibling.getAttributeNodeNS[http://parser.ru/second;attrname2]] | |
| =$Attr.nodeValue= | ^^x.getAttrinuteNS[...;attrname2]='^xdoc.documentElement.lastChild.previousSibling.getAttributeNS[http://parser.ru/second;attrname2]'<br /> |
| $Attr.nodeValue[changed attribute value] | $Attr[^xdoc.documentElement.lastChild.previousSibling.getAttributeNodeNS[http://parser.ru/second;attrname2]] |
| ^$Attr.nodeValue='$Attr.nodeValue'<br /> | |
| ^dump[$xdoc] | $Attr.nodeValue[changed attribute value] |
| ^dump[Changed attrname2 for last 'man' element;$xdoc] | |
| #intentionally not predeclaring namespace. todo: think about that stuff | |
| $newAttr[^xdoc.createAttributeNS[http://parser.ru/third;third:attrname3]] | |
| $oldAttr[^xdoc.documentElement.lastChild.previousSibling.setAttributeNodeNS[$newAttr]] | #intentionally not predeclaring namespace. todo: think about that stuff |
| ^if($oldAttr is xnode){wrong;right}<br> | $newAttr[^xdoc.createAttributeNS[http://parser.ru/third;third:attrname3]] |
| $newAttr.nodeValue[value3] | $oldAttr[^xdoc.documentElement.lastChild.previousSibling.setAttributeNodeNS[$newAttr]] |
| ^if($oldAttr is xnode){wrong;right}<br /> | |
| ^dump[$xdoc] | $newAttr.nodeValue[value3] |
| $NodeList[^xdoc.getElementsByTagNameNS[http://parser.ru/tst;findme]] | ^dump[Added attrname3 for last 'man' element;$xdoc] |
| ^show_xnodes1[$NodeList]<hr><hr> | |
| $man1[^xdoc.selectSingle[/people/man[@id=1]]] | $NodeList[^xdoc.getElementsByTagNameNS[http://parser.ru/tst;findme]] |
| ^if(^man1.hasAttribute[id]){right;wrong2!}<br> | ^show_xnodes1[$NodeList]<br /><br /> |
| ^if(^man1.hasAttributeNS[http://parser.ru/third;attrname3]){right;wrong3} | |
| $man1[^xdoc.selectSingle[/people/man[@id=1]]] | |
| <hr> | ^if(^man1.hasAttribute[id]){right;wrong2!}<br /> |
| ^if(^man1.hasAttributeNS[http://parser.ru/third;attrname3]){right;wrong3} | |
| @dump[xdoc] | |
| ^show_xdoc2[$xdoc]<hr> | <hr /> |
| ^show_xnode1[$xdoc]<hr> | |
| <hr> | /people/man[@id=1] ^if(^man1.hasAttributes[]){has;hasn't} attributes<br /> |
| $name2[^xdoc.selectSingle[/people/man[@id=1]/name]] | |
| @show1[array] | /people/man[@id=1]/name ^if(^name2.hasAttributes[]){has;hasn't} attributes<br /> |
| ^for[i](0;$array-1){ | |
| $x[$array.$i] | @dump[sTitle;xdoc] |
| $x.firstChild.nodeValue: | ^if(def $sTitle){<h2>$sTitle</h2>} |
| $pattributes[$x.parentNode.attributes] | ^show_xdoc2[$xdoc]<hr /> |
| ^if(^pattributes._count[]){ | ^show_xnode1[$xdoc]<hr /> |
| $pattributes.id.name=$pattributes.id.nodeValue | <hr /> |
| } | |
| <br> | @show1[array][i;x;pattributes] |
| } | ^for[i](0;$array-1){ |
| $x[$array.$i] | |
| @show_xnodes1[array][i] | $x.firstChild.nodeValue: |
| ^for[i](0;^array._count[]-1){ | $pattributes[$x.parentNode.attributes] |
| ^show_xnode1[$array.$i;0;1] | ^if(^pattributes._count[]){ |
| } | $pattributes.id.name=$pattributes.id.nodeValue |
| } | |
| @show_xnode1[x;level;single][l] | <br /> |
| ^if(def $x){ | } |
| ^for[l](0;$level-1){ ^; ^; ^; ^;} | |
| ^if($x.nodeType == $xnode:ELEMENT_NODE){ | @show_xnodes1[array][i] |
| <^;$x.nodeName | ^for[i](0;^array._count[]-1){ |
| $pairs[$x.attributes] | ^show_xnode1[$array.$i;0;1] |
| ^if(def $pairs){ | } |
| $names[^pairs._keys[]] | |
| ^names.menu{ $names.key="$pairs.[$names.key].nodeValue"} | @show_xnode1[x;level;single][l;pairs;names] |
| } | ^if(def $x){ |
| >^; | ^for[l](0;$level-1){ ^; ^; ^; ^;} |
| }{ | ^if($x.nodeType == $xnode:ELEMENT_NODE){ |
| [$x.nodeType] | <^;$x.nodeName |
| } | $pairs[$x.attributes] |
| ^if(def $pairs){ | |
| ^if(def $x.nodeValue){$x.nodeValue}<br> | $names[^pairs._keys[]] |
| ^show_xnode1[$x.firstChild]($level+1) | ^names.menu{ $names.key="$pairs.[$names.key].nodeValue"} |
| ^if(!$single){ | } |
| ^show_xnode1[$x.nextSibling]($level) | >^; |
| } | }{ |
| [$x.nodeType] | |
| ^if($x.nodeType == $xnode:ELEMENT_NODE){ | } |
| ^for[l](0;$level-1){ ^; ^; ^; ^;}<^;/$x.nodeName>^;<br> | |
| } | ^if(def $x.nodeValue){$x.nodeValue}<br /> |
| } | ^show_xnode1[$x.firstChild]($level+1) |
| ^if(!$single){ | |
| @show_xdoc2[xdoc] | ^show_xnode1[$x.nextSibling]($level) |
| #$response:body[^xdoc.file[ $.media-type[text/paf] ]] | } |
| <pre>^taint[html][^xdoc.string[ | |
| # $.method[html] | ^if($x.nodeType == $xnode:ELEMENT_NODE){ |
| # $.encoding[utF-8] | ^for[l](0;$level-1){ ^; ^; ^; ^;}<^;/$x.nodeName>^;<br /> |
| # $.omit-xml-declaration[yes] | } |
| # $.standalone[no] | } |
| # -$.doctype-public[-//W3C//DTD XHTML] | |
| # -$.doctype-system[/a/b/c/] | @show_xdoc2[xdoc] |
| # $.indent[yes] | #$response:body[^xdoc.file[ $.media-type[text/paf] ]] |
| # $.media-type[text/paf] | <pre>^taint[html][^xdoc.string[ |
| ]] | # $.method[html] |
| </pre> | # $.encoding[utF-8] |
| # $.omit-xml-declaration[yes] | |
| # $.standalone[no] | |
| # -$.doctype-public[-//W3C//DTD XHTML] | |
| # -$.doctype-system[/a/b/c/] | |
| # $.indent[yes] | |
| # $.media-type[text/paf] | |
| ]] | |
| </pre> |