File:  [parser3project] / parser3 / tests / 097.html
Revision 1.7: download - view: text, annotated - select for diffs - revision graph
Fri May 19 16:49:53 2017 UTC (9 years, 1 month ago) by moko
Branches: MAIN
CVS tags: release_3_5_1, release_3_5_0, release_3_4_6, HEAD
after parser.ru moved to https

@main[]
$response:charset[UTF-8]
$request:charset[UTF-8]

$file[^file::load[binary;http://www.parser.ru/_/tests/none/;
	$.headers[
		$.USER-AGENT[paf]
	]
	$.timeout(10)
	$.any-status(1)
]]
#server: $file.SERVER<br>
$file.status
#<pre>$file.text</pre>


<hr />
^try{
	$file[^file::load[binary;http://www.parser.ru/xmlview.xsl;
		$.timeout(10)
		$.any-status(1)
	]]
	^try{
		$xdoc[^xdoc::create[$file]]
		xdoc from file created successfully (documentElement: $xdoc.documentElement.nodeName)
	}{
		can't create xdoc from file.
		$exception.handled(1)
	}
}{
	can't load remote file.
	$exception.handled(1)
}

<hr />
^try{
	$xdoc[^xdoc::load[http://www.parser.ru/xmlview.xsl]]
	remote xdoc loaded successfully (documentElement: $xdoc.documentElement.nodeName)
}{
	can't load remote xdoc.
	$exception.handled(1)
}


<hr />
^try{
	$xdoc[^xdoc::load[108.xsl]]
	local xdoc loaded successfully (documentElement: $xdoc.documentElement.nodeName)
}{
	can't load local xdoc.
	$exception.handled(1)
}


<hr />
Loading remote file in windows-1251:
^try{
	$file[^file::load[text;http://www.parser.ru/_/tests/097.html;
		$.charset[windows-1251]
		$.timeout(10)
		$.form[
			$.charset[windows-1251]
			$.title[Проверка]
		]
	]]
	<p>$file.text</p>
}{
	$exception.handled(1)
	can't load remote file. 
}


<hr />
Loading remote file in UTF-8:
^try{
	$file[^file::load[text;http://www.parser.ru/_/tests/097.html;
		$.timeout(10)
		$.form[
			$.charset[UTF-8]
			$.title[Проверка]
		]
	]]
	<p>$file.text</p>
}{
	$exception.handled(1)
	can't load remote file. 
}

E-mail: