File:
[parser3project] /
parser3 /
tests /
107.html
Revision
1.5:
download - view:
text,
annotated -
select for diffs -
revision graph
Sun Jul 25 06:14:46 2010 UTC (15 years, 11 months ago) by
misha
Branches:
MAIN
CVS tags:
release_3_5_1,
release_3_5_0,
release_3_4_6,
release_3_4_5,
release_3_4_4,
release_3_4_3,
release_3_4_2,
release_3_4_1,
HEAD
- prepare tests to trim trailing methods' EOLs
@main[]
$request:charset[UTF-8]
$response:charset[UTF-8]
$response:content-type[
$.value[text/html]
$.charset[$response:charset]
]
^xdata[]
^show_xdoc2[$xdoc]<hr>
^show_xnode1[$xdoc]<hr>
XPath1 [*/man]:<br>
$people[^xdoc.select[*/man]]
^show_xnodes1[$people]<hr>
XPath1 [//man]:<br>
$people[^xdoc.select[//man]]
^show_xnodes1[$people]<hr>
XPath2 [*/man[2]/name]:<br>
^show_xnode1[^xdoc.selectSingle[*/man[2]/name];0;1]<hr>
@xdata[]
$xdoc[^xdoc::create{<?xml version="1.0" encoding="$request:charset"?>
<!--for getByID to work we need to enable doctype checking in pa_global.C :( <?DOCTYPE people SYSTEM "107.dtd"?>-->
<people>
<man id="1" имя="word слово">
<name>P«^;AF B</name>
</man>
<man id="2">
<name>ПИФ^taint[&]</name>
</man>
<group>
<man id="3">
<name>ПАФ</name>
</man>
</group>
</people>
}]
@show1[array]
^for[i](0;$array-1){
$x[$array.$i]
$x.firstChild.nodeValue:
$pattributes[$x.parentNode.attributes]
^if(^pattributes._count[]){
$pattributes.id.name=$pattributes.id.nodeValue
}
<br>
}
@show_xnodes1[array][i]
^for[i](0;^array._count[]-1){
^show_xnode1[$array.$i;0;1]
}
@show_xnode1[x;level;single][l;key;value]
^if(def $x){
^for[l](0;$level-1){ ^; ^; ^; ^;}
^if($x.nodeType == $xnode:ELEMENT_NODE){
<^;$x.nodeName^if(def $x.attributes){^x.attributes.foreach[key;value]{ $key="$value.nodeValue"}}>^;
}{
[$x.nodeType]
}
^if(def $x.nodeValue){$x.nodeValue}<br>
^show_xnode1[$x.firstChild]($level+1)
^if(!$single){
^show_xnode1[$x.nextSibling]($level)
}
^if($x.nodeType == $xnode:ELEMENT_NODE){
^for[l](0;$level-1){ ^; ^; ^; ^;}<^;/$x.nodeName>^;<br>
}
}
@show_xdoc2[xdoc]
#$response:body[^xdoc.file[ $.media-type[text/paf] ]]
<pre>^taint[html][^xdoc.string[
$.method[html]
# $.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>
E-mail: