Project

Profile

Help

Revision 6304fb8b

Added by O'Neil Delpratt 5 months ago

Saxon/C bug fixes and development work

View differences:

latest10/hec/Saxon.C.API/readme.txt
234 234

  
235 235
        xslt->setSourceFile("xml/foo.xml");
236 236
	XdmAtomicValue * xdmvaluex =processor->makeStringValue("Hello to you");
237
	if(xdmvaluex !=NULL){
237
	if(xdmvaluex !=nullptr){
238 238
		cerr<< "xdmvaluex ok"<<endl; 			
239 239
	}
240 240
	xslt->setParameter("a-param", xdmvaluex);
241
        const char * result = test->transformFileToString(NULL, "xsl/foo.xsl");
242
	if(result != NULL) {
241
        const char * result = test->transformFileToString(nullptr, "xsl/foo.xsl");
242
	if(result != nullptr) {
243 243
		cerr<<result<<endl;
244 244
	} else {
245
		cerr<<"Result is NULL"<<endl;
245
		cerr<<"Result is nullptr"<<endl;
246 246
	}
247 247
	processor->clearParameters(true);
248 248
	processor->clearProperties();
......
256 256

  
257 257
    xslt->setInitialMatchSelectionAsFile("cat.xml");
258 258
    const char * output = xslt->applyTemplatesReturningString("test.xsl");
259
	if(output !=NULL){
259
	if(output !=nullptr){
260 260
		cerr<< output<<endl; 			
261 261
	}
262 262
	XdmValue * values = new XdmValue(processor);
......
270 270
    xslt->setInitialMatchSelection((XdmValue*)input);
271 271
	xslt->compileFromFile("test2.xsl");
272 272
    
273
    const char * rootValue = trans->callTemplateReturningString(NULL, "main");
273
    const char * rootValue = trans->callTemplateReturningString(nullptr, "main");
274 274

  
275 275
	
276
	if(rootValue != NULL) {
276
	if(rootValue != nullptr) {
277 277
		cerr<<rootValue<<endl;
278 278
	} else {
279
		cerr<<"Result is NULL"<<endl;
279
		cerr<<"Result is nullptr"<<endl;
280 280
	}
281 281
	xslt->clearParameters(true);
282 282
	xslt->clearProperties();
......
348 348

  
349 349
	XdmValue * resultValues = xpath->evaluate("//person");
350 350
	
351
	if(resultValues == NULL) {
352
		 printf("result is null \n");
351
	if(resultValues == nullptr) {
352
		 printf("result is nullptr \n");
353 353
	} else {
354 354
		cout<<"Number of items="<<resultValues->size();
355 355
		for(int i =0; i< resultValues->size();i++){
356 356
			XdmItem * itemi = resultValues->itemAt(i);
357
			if(itemi == NULL) {
358
				cout<<"Item at position "<<i<<" should not be null";
357
			if(itemi == nullptr) {
358
				cout<<"Item at position "<<i<<" should not be nullptr";
359 359
				break;
360 360
			}
361 361
			cout<<"Item at "<<i<<" ="<<itemi->getStringValue(processor);		
......
404 404
	val->setProperty("verbose", "true");
405 405
	val->validate("family.xml");
406 406
	XdmNode * node = val->getValidationReport(); 
407
	if(node != NULL) {
407
	if(node != nullptr) {
408 408
		cout<<"Validation Report"<<node->getStringValue();
409 409
	} else {
410
		cout<<"Error: Validation Report is NULL";
410
		cout<<"Error: Validation Report is nullptr";
411 411
	}
412 412
</code></pre>
413 413

  
......
452 452
|  |  |
453 453
| ----: | :---- |
454 454
| void | transformFileToFile(string $sourceFileName, string $stylesheetFileName, string outputfileName) <br> *Perform a one shot transformation. The result is stored in the supplied outputfile name.*  |
455
| string | transformFileToString(string $sourceFileName, string $stylesheetFileName) <br> *Perform a one shot transformation. The result is returned as a string. If there are failures then a null is returned* |
455
| string | transformFileToString(string $sourceFileName, string $stylesheetFileName) <br> *Perform a one shot transformation. The result is returned as a string. If there are failures then a nullptr is returned* |
456 456
| XdmValue | transformFileToValue(string $fileName) <br> *Perform a one shot transformation. The result is returned as an XdmValue* |
457 457
| void | transformToFile() <br> *Perform the transformation based upon cached stylesheet and source document.* |
458 458
| string | transformToString() |
459
| XdmValue | transformToValue() <br> *Perform the transformation based upon cached stylesheet and any source document. Result returned as an XdmValue object. If there are failures then a null is returned* |
459
| XdmValue | transformToValue() <br> *Perform the transformation based upon cached stylesheet and any source document. Result returned as an XdmValue object. If there are failures then a nullptr is returned* |
460 460
| void | compileFromFile(string $fileName) <br> *Compile a stylesheet suplied as by file name* |
461 461
| void | compileFromString(string $str) <br> *Compile a stylesheet received as a string.*  |
462 462
| void | compileFromValue(XdmNode $node)<br> *Compile a stylesheet received as an XdmNode.* |
......
480 480
|  |  |
481 481
| ----: | :---- |
482 482
| void | addPackages(array packageFileNames) <br> *File names to XsltPackages stored on filestore are added to a set of packages, which will imported later for use when compiling.*  |
483
| void | applyTemplatesReturningFile(string $stylesheetFileName) <br> *Invoke the stylesheet by applying templates to a supplied input sequence, Saving the results to file. The stylesheet file name argument can be supplied here. If null then the most recently compiled stylsheet is used.*  |
484
| string | applyTemplatesReturningString(string $stylesheetFileName) <br> *Invoke the stylesheet by applying templates to a supplied input sequence. The result is returned as a serialized string. The stylesheet file name argument can be supplied here. If null then the most recently compiled stylsheet is used.* |
485
| PyXdmValue | applyTemplatesReturningValue(string $stylesheetFileName) <br> *Invoke the stylesheet by applying templates to a supplied input sequence. the result is returned as an XdmValue object. The stylesheet file name argument can be supplied here. If null then the most recently compiled stylsheet is used.* |
483
| void | applyTemplatesReturningFile(string $stylesheetFileName) <br> *Invoke the stylesheet by applying templates to a supplied input sequence, Saving the results to file. The stylesheet file name argument can be supplied here. If nullptr then the most recently compiled stylsheet is used.*  |
484
| string | applyTemplatesReturningString(string $stylesheetFileName) <br> *Invoke the stylesheet by applying templates to a supplied input sequence. The result is returned as a serialized string. The stylesheet file name argument can be supplied here. If nullptr then the most recently compiled stylsheet is used.* |
485
| PyXdmValue | applyTemplatesReturningValue(string $stylesheetFileName) <br> *Invoke the stylesheet by applying templates to a supplied input sequence. the result is returned as an XdmValue object. The stylesheet file name argument can be supplied here. If nullptr then the most recently compiled stylsheet is used.* |
486 486
| void | compileFromAssociatedFile(string xmlFileName)<br> *Get the stylesheet associated via the xml-stylesheet processing instruction (see http://www.w3.org/TR/xml-stylesheet/) with the document document specified in the source parameter, and that match the given criteria.  If there are several suitable xml-stylesheet processing instructions, then the returned Source will identify a synthesized stylesheet module that imports all the referenced stylesheet module.* |
487 487
| void | compileFromFile(string $fileName) <br> *Compile a stylesheet suplied as by file name* |
488 488
| void | compileFromString(string $str) <br> *Compile a stylesheet received as a string.*  |
......
493 493
| void | callFunctionReturningFile(string $FunctionName, array arguments, string outputfileName) <br> *Call a public user-defined function in the stylesheet. Here we wrap the result in an XML document, and sending this document to a specified file. Arguments: function name and array of XdmValue objects - he values of the arguments to be supplied to the function. These will be converted if necessary to the type as defined in the function signature, using the function conversion rules. *  |
494 494
| string | callFunctionReturningString(string $FunctionName, array arguments) <br> *Call a public user-defined function in the stylesheet. Here we wrap the result in an XML document, and serialized this document to string value. Arguments: function name and array of XdmValue objects - he values of the arguments to be supplied to the function. These will be converted if necessary to the type as defined in the function signature, using the function conversion rules.* |
495 495
| PyXdmValue | callFunctionReturningValue(string $FunctionName, array arguments) <br> *Call a public user-defined function in the stylesheet. Here we wrap the result in an XML document, and return the document as an XdmVale. Arguments: function name and array of XdmValue objects - he values of the arguments to be supplied to the function. These will be converted if necessary to the type as defined in the function signature, using the function conversion rules.* |
496
| void | callTemplateReturningFile(string $stylesheetFileName, string $templateName, string outputfileName) <br> *Invoke a transformation by calling a named template. The result is stored in the supplied outputfile name. If the templateName argument is null then the xsl:iitial-template is used. Parameters supplied using setInitialTemplateParameters are made available to the called template.*  |
497
| string | callTemplateReturningString(string $stylesheetFileName, string $templateName) <br> *Invoke a transformation by calling a named template and return result as a string. If the templateName argument is null then the xsl:iitial-template is used. Parameters supplied using setInitialTemplateParameters are made available to the called template.* |
498
| PyXdmValue | callTemplateReturningValue(string $stylesheetFileName, string $templateName) <br> *Invoke a transformation by calling a named template and return result as an XdmValue. If the templateName argument is null then the xsl:iitial-template is used. Parameters supplied using setInitialTemplateParameters are made available to the called template.* |
496
| void | callTemplateReturningFile(string $stylesheetFileName, string $templateName, string outputfileName) <br> *Invoke a transformation by calling a named template. The result is stored in the supplied outputfile name. If the templateName argument is nullptr then the xsl:iitial-template is used. Parameters supplied using setInitialTemplateParameters are made available to the called template.*  |
497
| string | callTemplateReturningString(string $stylesheetFileName, string $templateName) <br> *Invoke a transformation by calling a named template and return result as a string. If the templateName argument is nullptr then the xsl:iitial-template is used. Parameters supplied using setInitialTemplateParameters are made available to the called template.* |
498
| PyXdmValue | callTemplateReturningValue(string $stylesheetFileName, string $templateName) <br> *Invoke a transformation by calling a named template and return result as an XdmValue. If the templateName argument is nullptr then the xsl:iitial-template is used. Parameters supplied using setInitialTemplateParameters are made available to the called template.* |
499 499
| void | transformFileToFile(string $sourceFileName, string $stylesheetFileName, string outputfileName) <br> *Perform a one shot transformation. The result is stored in the supplied outputfile name.*  |
500 500
| XdmValue | transformFileToValue(string $fileName) <br> *Perform a one shot transformation. The result is returned as an XdmValue* |
501 501
| XdmValue | transformFileToString(string $fileName) <br> *Perform a one shot transformation. The result is returned as a stringe* |
502 502
| void | transformToFile() <br> *Perform the transformation based upon cached stylesheet and source document. Result is saved to the supplied file name* |
503 503
| string | transformToString() <br> *Perform the transformation based upon cached stylesheet and source document. Result is returned as a serialized string* |
504
| PyXdmValue | transformToValue() <br> *Perform the transformation based upon cached stylesheet and any source document. Result returned as an XdmValue object. If there are failures then a null is returned* |
504
| PyXdmValue | transformToValue() <br> *Perform the transformation based upon cached stylesheet and any source document. Result returned as an XdmValue object. If there are failures then a nullptr is returned* |
505 505
| void | setInitialTemplateParameters(array parameters, bool tunnel) <br> *Set parameters to be passed to the initial template. These are used whether the transformation is invoked by applying templates to an initial source item, or by invoking a named template. The parameters in question are the xsl:param elements appearing as children of the xsl:template element. The tunnel argument if set to true these values are to be used for setting tunnel parameters.* |
506 506
| void | setInitialMatchSelection() <br> *The initial value to which templates are to be applied (equivalent to the 'select' attribute of xsl:apply-templates)*|
507 507
| void | setInitialMatchSelectionAsFile <br> *The initial filename to which templates are to be applied (equivalent to the 'select' attribute of xsl:apply-templates) * |
......
526 526

  
527 527
|  |  |
528 528
| ----: | :---- |
529
| XdmValue | runQueryToValue() <br> *compile and evaluate the query. Result returned as an XdmValue object. If there are failures then a null is returned* |
530
| string | runQueryToString() <br> *compile and evaluate the query. Result returned as string. If there are failures then a null is returned* |
529
| XdmValue | runQueryToValue() <br> *compile and evaluate the query. Result returned as an XdmValue object. If there are failures then a nullptr is returned* |
530
| string | runQueryToString() <br> *compile and evaluate the query. Result returned as string. If there are failures then a nullptr is returned* |
531 531
| void | runQueryToFile(string $outfilename) <br> *compile and evaluate the query. Save the result to file* |
532 532
| void | setQueryContent(string $str) <br> *query supplied as a string* |
533 533
| void | setQueryItem(XdmItem $item) <br> ** |
......
576 576
| void | registerSchemaFromFile(string $fileName) <br> *Register the Schema which is given as file name.* |
577 577
| void | registerSchemaFromString(string $schemaStr) <br> *Register the Schema which is given as a string representation.* |
578 578
| void | validate() <br> *Validate an instance document supplied as a Source object. Assume source document has already been supplied through accessor methods* | 
579
| void | validate(string $fileName) <br> *Validate an instance document supplied as a Source object. $filename - The name of the file to be validated. $filename can be null* |
579
| void | validate(string $fileName) <br> *Validate an instance document supplied as a Source object. $filename - The name of the file to be validated. $filename can be nullptr* |
580 580
| XdmNode | validateToNode() <br> *Validate an instance document supplied as a Source object with the validated document returned to the calling program. Assume source document has already been supplied through accessor methods* |
581
| XdmNode | validateToNode(string $fileName) <br> *Validate an instance document supplied as a Source object with the validated document returned to the calling program. $filename - The name of the file to be validated. $filename can be null* |
581
| XdmNode | validateToNode(string $fileName) <br> *Validate an instance document supplied as a Source object with the validated document returned to the calling program. $filename - The name of the file to be validated. $filename can be nullptr* |
582 582
| XdmNode | getValidationReport <br> *Get the valdiation report produced after valdiating the soucre document. The reporting feature is switched on via setting the property on the SchemaValidator: validator.setProperty('report', 'true'). Return XdmNode* |
583 583
| void | setParameter(string $name, XdmValue $value) <br> *Set the parameters required for XQuery Processor* |
584 584
| void | setProperty(string $name, string $value) <br> *Set properties for Schema Validator.* |
......
607 607
| string | getStringValue() <br> *Get the string value of the item. For a node, this gets the string value of the node. For an atomic value, it has the same effect as casting the value to a string. In all cases the result is the same as applying the XPath string() function.* |
608 608
| boolean |  isNode() <br> *Determine whether the item is a node value or not.* |
609 609
| boolean |  isAtomic() <br> *Determine whether the item is an atomic value or not.* |
610
|  XdmAtomicValue| getAtomicValue() <br> *Provided the item is an atomic value we return the XdmAtomicValue otherwise return null* |
611
| XdmNode |  getNodeValue() <br> *Provided the item is a node value we return the XdmNode otherwise return null* |
610
|  XdmAtomicValue| getAtomicValue() <br> *Provided the item is an atomic value we return the XdmAtomicValue otherwise return nullptr* |
611
| XdmNode |  getNodeValue() <br> *Provided the item is a node value we return the XdmNode otherwise return nullptr* |
612 612

  
613 613
#### Saxon\\XdmNode class ####
614 614
<sup>PHP API</sup>
......
621 621
| boolean | isAtomic() <br> *Determine whether the item is an atomic value or a node. This method will return FALSE as the item is not atomic* |
622 622
| int | getChildCount() <br> *Get the count of child node at this current node* |
623 623
| int | getAttributeCount() <br> *Get the count of  attribute nodes at this node* |
624
| XdmNode | getChildNode(int index) <br> *Get the n'th child node at this node. If the child node selected does not exist then return null* |
625
| XdmNode | getParent() <br> *Get the parent of this node. If parent node does not exist then return null* |
626
| XdmNode | getAttributeNode(int $index) <br> *Get the n'th attribute node at this node. If the attribute node selected does not exist then return null* |
627
| string | getAttributeValue(int $index) <br> *Get the n'th attribute node value at this node. If the attribute node selected does not exist then return null* |
624
| XdmNode | getChildNode(int index) <br> *Get the n'th child node at this node. If the child node selected does not exist then return nullptr* |
625
| XdmNode | getParent() <br> *Get the parent of this node. If parent node does not exist then return nullptr* |
626
| XdmNode | getAttributeNode(int $index) <br> *Get the n'th attribute node at this node. If the attribute node selected does not exist then return nullptr* |
627
| string | getAttributeValue(int $index) <br> *Get the n'th attribute node value at this node. If the attribute node selected does not exist then return nullptr* |
628 628

  
629 629
#### Saxon\\XdmAtomicValue class ####
630 630
<sup>PHP API</sup>
......
691 691
        $xsltProc->setSourceFromFile($xmlfile);
692 692
        $xsltProc->compileFromFile($xslFile);      
693 693
        $result = $xsltProc->transformToString();               
694
		if($result != null) {               
694
		if($result != nullptr) {
695 695
		  echo '<b>exampleSimple1:</b><br/>';
696 696
		  echo 'Output:'.$result;
697 697
		} else {
698
			echo "Result is null";
698
			echo "Result is nullptr";
699 699
		}
700 700
		$xsltProc->clearParameters();
701 701
		$xsltProc->clearProperties(); 
......
716 716
                
717 717
            $result = $xsltProc->transformToString();
718 718
                
719
            if($result == NULL) {
719
            if($result == nullptr) {
720 720
                    $errCount = $xsltProc->getExceptionCount();
721 721
				    if($errCount > 0 ){ 
722 722
				        for($i = 0; $i < $errCount; $i++) {

Also available in: Unified diff