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/python-saxon/saxonc.pyx
20 20
    if str_value is None:
21 21
        return NULL
22 22
    else:
23
        c_string = str_value.encode('UTF-8')
23
        py_string_string = str_value.encode('UTF-8') if str_value is not None else None
24
        c_string = py_string_string if str_value is not None else ""
24 25
        return c_string
25 26

  
26 27
cdef str make_py_str(const char * c_value):
......
116 117
         py_value_string = cwd.encode('UTF-8') if cwd is not None else None
117 118
         cdef char * c_str_ = py_value_string if cwd is not None else ""
118 119
         self.thisptr.setcwd(c_str_)
119
    
120

  
120 121

  
121 122
    def set_resources_directory(self, dir_):
122 123
        """
123
        Property to set or get resources directory 
124
        
124
        Property to set or get resources directory
125

  
125 126
        :str: A string of the resources directory which Saxon will use
126 127

  
127 128
        """
128
        py_value_string = dir_.encode('UTF-8') if dir_ is not None else None
129
        cdef char * c_str_ = py_value_string if dir_ is not None else ""
130
        self.thisptr.setResourcesDirectory(c_str_)
131 129

  
132 130
    @property
133 131
    def resources_directory(self):
134
        cdef const char* c_string = self.thisptr.getResourcesDirectory()
135
        ustring = c_string.decode('UTF-8') if c_string is not NULL else None
136
        return ustring
132
        return NULL
137 133
    
138 134
    def set_configuration_property(self, name, value):
139 135
        """
......
248 244
        of a zero-length string (and potentially other strings, in future)
249 245
        
250 246
        Args:
251
            str_ (str): the String value. Null is taken as equivalent to "".
247
            str_ (str): the String value. NULL is taken as equivalent to "".
252 248

  
253 249
        Returns:
254 250
            PyXdmAtomicValue: The corresponding Xdm StringValue
......
569 565

  
570 566
        Args:
571 567
            name (str): the name of the stylesheet parameter, as a string. For namespaced parameter use the JAXP solution i.e. "{uri}name
572
            value (PyXdmValue): the value of the stylesheet parameter, or null to clear a previously set value
568
            value (PyXdmValue): the value of the stylesheet parameter, or NULL to clear a previously set value
573 569

  
574 570
        """
575 571
        cdef const char * c_str = make_c_str(name)
......
1164 1160

  
1165 1161
        Args:
1166 1162
            name (str): the name of the stylesheet parameter, as a string. For namespaced parameter use the JAXP solution i.e. "{uri}name
1167
            value (PyXdmValue): the value of the stylesheet parameter, or null to clear a previously set value
1163
            value (PyXdmValue): the value of the stylesheet parameter, or NULL to clear a previously set value
1168 1164

  
1169 1165
        """
1170 1166
        cdef const char * c_str = make_c_str(name)
......
1811 1807
               xsltproc.call_template_returning_file("go", output_file="result.xml")
1812 1808
			   print(result)
1813 1809
        """
1814
        cdef char * c_outputfile = NULL       
1810
        cdef char * c_outputfile = NULL
1815 1811
        cdef const char * c_templateName = NULL
1816 1812
        cdef const char * c_sourcefile = NULL
1817 1813
        cdef const char * c_stylesheetfile = NULL
......
2710 2706
            xpath_str (str): The XPath query supplied as a string
2711 2707

  
2712 2708
        Returns:
2713
            PyXdmItem: A single Xdm Item is returned 
2709
            PyXdmItem: A single Xdm Item is returned. return None if the expression returns an empty sequence.
2710
            If the expression returns a sequence of more than one item, any items after the first are ignored.
2714 2711

  
2715 2712
        """
2716 2713
        cdef PyXdmNode val = None
......
3128 3125

  
3129 3126
        """
3130 3127
        cdef PyXdmNode val = None
3131
        cdef saxoncClasses.XdmNode * xdmNode = NULL             
3128
        cdef saxoncClasses.XdmNode * xdmNode = NULL
3132 3129
        xdmNode = self.thissvptr.getValidationReport()
3133 3130
        if xdmNode == NULL:
3134 3131
            return None
......
3291 3288
        if type(self) is PyXdmValue:
3292 3289
            self.thisvptr = new saxoncClasses.XdmValue() 
3293 3290
     def __dealloc__(self):
3294
        if type(self) is PyXdmValue and self.thisvptr != NULL:    
3291
        if type(self) is PyXdmValue and self.thisvptr != NULL:
3295 3292
            if self.thisvptr.getRefCount() < 1:
3296 3293
                del self.thisvptr            
3297 3294
            else:
......
3596 3593
        This will be the same as the System ID unless xml:base has been used. Where the node does not have a base URI of its own,
3597 3594
        the base URI of its parent node is returned.
3598 3595
        Returns:
3599
            str: String value of the base uri for this node. This may be null if the base URI is unknown, including the case
3596
            str: String value of the base uri for this node. This may be NULL if the base URI is unknown, including the case
3600 3597
                 where the node has no parent.
3601 3598
        """
3602 3599
        return make_py_str(self.derivednptr.getBaseUri())

Also available in: Unified diff