Project

Profile

Help

Revision e54a0d4a

Added by O'Neil Delpratt almost 3 years ago

Saxon/C update

View differences:

latest9.8/hec/samples/php/xqueryExamples.php
8 8
            
9 9
            /* simple example to show transforming to string */
10 10
            function exampleSimple1($proc, $xmlfile, $queryFile){
11
		echo '<b>exampleSimple1:</b><br/>';
11 12
                $proc->setContextItemFromFile($xmlfile);
13
echo '<b>exampleSimple cp1:</b><br/>';
12 14
                $proc->setQueryFile($queryFile);
15
echo '<b>exampleSimple cp2:</b><br/>';
13 16
  	        //$proc->setProperty('base', '/');      
14
                $result = $proc->runQueryToString();               
17
                $result = $proc->runQueryToString();  
18
echo '<b>exampleSimple cp3:</b><br/>';             
15 19
		if($result != null) {               
16
		echo '<b>exampleSimple1:</b><br/>';		
20
				
17 21
		echo 'Output:'.$result;
18 22
		} else {
19 23
			echo "Result is null";
......
27 31
		$sourceNode = $proc->parseXmlFromString("<foo xmlns='http://one.uri/'><bar><b>text node in example</b></bar></foo>");
28 32
		if($sourceNode !=null){
29 33
			/*echo "Name of Class " , get_class($sourceNode) , "\n"; 			
30
			$str = $xdmvalue->getStringValue();
34
			$str = $sourceNode->getStringValue();
31 35
			if($str!=null) {
32 36
				echo "XdmValue:".$str;
33 37
			} */
latest9.8/hec/samples/php/xsltExamples.php
48 48
		echo '<b>userFunctionExample:</b><br/>';
49 49
		global $resultg;
50 50

  
51
		$proc->setProperty("extc","/usr/lib/php/20160303/saxon" ); //"/home/ond1/work/new-svn/latest9.8-hec/hec/samples/cppTests/cppExtensionFunction"
52
		$saxon->registerPHPFunction("/usr/lib/php/20160303/saxon");
51
		$proc->setProperty("extc","/home/ond1/work/svn/latest9.8-saxonc/hec/Saxon.C.API/php7-src/PHP-Build/lib/php/extensions/debug-non-zts-20160303/saxon" ); //"/home/ond1/work/new-svn/latest9.8-hec/hec/samples/cppTests/cppExtensionFunction"
52
		$saxon->registerPHPFunction("/home/ond1/work/svn/latest9.8-saxonc/hec/Saxon.C.API/php7-src/PHP-Build/lib/php/extensions/debug-non-zts-20160303/saxon");
53 53
 		$proc->setSourceFromFile($xmlfile);
54 54
                $proc->compileFromFile($xslFile);
55 55
		
......
75 75
            
76 76
            /* simple example to show transforming to string */
77 77
            function exampleSimple1($proc, $xmlfile, $xslFile){
78
		echo '<b>exampleSimple1:</b><br/>';
78 79
                $proc->setSourceFromFile($xmlfile);
79 80
                $proc->compileFromFile($xslFile);
80 81
  	              
81 82
                $result = $proc->transformToString();               
82 83
		if($result != null) {               
83
		echo '<b>exampleSimple1:</b><br/>';		
84
				
84 85
		echo 'Output:'.$result;
85 86
		} else {
86 87
			echo "Result is null";
......
146 147
echo '<b>exampleLoopVar:</b><br/>';
147 148
$proc->setSourceFromFile($xml);
148 149
$proc->compileFromFile($xslt);
149
$values = array();
150

  
150 151
foreach($params as $name => $value) {
151 152
echo "loop itr";
152 153
  $xdmValue = $saxonProc->createAtomicValue(strval($value));
......
265 266
            function exampleXMLFilterChain2($saxonProc, $proc, $xmlFile, $xsl1File, $xsl2File, $xsl3File){
266 267
                echo '<b>XML Filter Chain using Parameters1</b><br/>';                
267 268
                $xdmNode = $saxonProc->parseXmlFromFile($xmlFile);
268
 echo '<b>XML Filter Chain using using Parameters1 cp0</b><br/>'; 
269
 echo '<b>exampleXMLFilterChain2: XML Filter Chain using Parameters1 cp0</b><br/>'; 
269 270
		if($xdmNode == NULL) {
270
			echo 'source node is NULL';
271
			echo 'source node is NULLXXXXXXX';
271 272
		}
272 273
                $proc->setParameter('node', $xdmNode);
273 274
 echo '<b>XML Filter Chain using using Parameters1 cp1</b><br/>';
......
275 276
  echo '<b>XML Filter Chain using using Parameters1 cp2</b><br/>';
276 277
                $xdmValue1 = $proc->transformToValue();
277 278
		if($xdmValue1== null) { 
278
			echo '<b>XML Filter Chain using using Parameters1 cp3-0 null</b><br/>';
279
			echo '<b>XML Filter Chain using using Parameters1 cp3-0 nullYYYYYYY</b><br/>';
279 280
		}
280 281
 echo '<b>XML Filter Chain using using Parameters1 cp3</b><br/>';
281 282
 		$errCount = $proc->getExceptionCount();
......
419 420
            echo '<br/>';
420 421
            exampleXMLFilterChain($proc, $foo_xml, $foo_xsl, $foo2_xsl, $foo3_xsl);
421 422
            echo '<br/>';                    
422
           exampleXMLFilterChain2($saxonProc, $proc, $foo_xml, $foo_xsl, $foo2_xsl, $foo3_xsl);       
423
           exampleXMLFilterChain2($saxonProc, $proc, $foo_xml, $foo_xsl, $foo2_xsl, $foo3_xsl);     
423 424
            echo '<br/>';  
424
	    //userFunctionExample($saxonProc, $proc,  $foo_xml, 'xsl/testExFunc.xsl'); //corruption in memory
425
	   // userFunctionExample($saxonProc, $proc,  $foo_xml, 'xsl/testExFunc.xsl'); //corruption in memory
425 426
            echo '<br/>';
426 427
            unset($proc);
427 428
	    unset($saxonproc);

Also available in: Unified diff