@@ -558,7 +558,7 @@ def append_transform_xpath_attribute(self, xpath_string: str, prefix: str, names
558558 # Parameter: element -> Element name
559559 # Return: CHANGED FOR PYLIBSRCML: returns nothing, simply raises an error if status isn't OK
560560 # -------------------------------------------------------------------------------------------
561- def append_transform_xpath_element (self , xpath_string : str , prefix : str , namespace_uri : str , element : str ) :
561+ def append_transform_xpath_element (self , xpath_string : str , prefix : str , namespace_uri : str , element : str ) -> None :
562562 if type (xpath_string ) != str :
563563 raise srcMLTypeError (self .append_transform_xpath_element ,"xpath_string" ,xpath_string )
564564 if type (prefix ) != str :
@@ -647,6 +647,55 @@ def append_transform_relaxng_file(self, relaxng_file: File) :
647647 raise srcMLTypeError (self .append_transform_relaxng_file ,"relaxng_file" ,relaxng_file )
648648 check_srcml_status (libsrcml .srcml_append_transform_relaxng_fd (self .c_archive , relaxng_file .fileno ()))
649649
650+ # -------------------------------------------------------------------------------------------
651+ # Append the srcQL query to the list of transformations/queries
652+ # -------------------------------------------------------------------------------------------
653+ def append_transform_srcql (self , srcql_string : str ) -> None :
654+ if type (srcql_string ) != str :
655+ raise srcMLTypeError (self .append_transform_srcql ,"srcql_string" ,srcql_string )
656+
657+ status = libsrcml .srcml_append_transform_srcql (self .c_archive , srcql_string .encode ())
658+ check_srcml_status (status )
659+
660+ # -------------------------------------------------------------------------------------------
661+ # Append the srcQL query to the list of transformations/queries.
662+ # Instead of outputting the results in a separate unit tag, output the complete
663+ # archive marking the XPath results with a user provided element.
664+ # -------------------------------------------------------------------------------------------
665+ def append_transform_srcql_attribute (self , srcql_string : str , prefix : str , namespace_uri : str , attr_name : str , attr_value : str ) -> None :
666+ if type (srcql_string ) != str :
667+ raise srcMLTypeError (self .append_transform_srcql_attribute ,"srcql_string" ,srcql_string )
668+ if type (prefix ) != str :
669+ raise srcMLTypeError (self .append_transform_srcql_attribute ,"prefix" ,prefix )
670+ if type (namespace_uri ) != str :
671+ raise srcMLTypeError (self .append_transform_srcql_attribute ,"namespace_uri" ,namespace_uri )
672+ if type (attr_name ) != str :
673+ raise srcMLTypeError (self .append_transform_srcql_attribute ,"attr_name" ,attr_name )
674+ if type (attr_value ) != str :
675+ raise srcMLTypeError (self .append_transform_srcql_attribute ,"attr_value" ,attr_value )
676+
677+ status = libsrcml .srcml_append_transform_srcql_attribute (self .c_archive , srcql_string .encode (), prefix .encode (), namespace_uri .encode (), attr_name .encode (), attr_value .encode ())
678+ check_srcml_status (status )
679+
680+
681+ # -------------------------------------------------------------------------------------------
682+ # Append the srcQL query to the list of transformations/queries.
683+ # Instead of outputting the results in a separate unit tag, output the complete
684+ # archive marking the XPath results with a user provided element.
685+ # -------------------------------------------------------------------------------------------
686+ def append_transform_srcql_element (self , srcql_string : str , prefix : str , namespace_uri : str , element : str ) -> None :
687+ if type (srcql_string ) != str :
688+ raise srcMLTypeError (self .append_transform_srcql_element ,"srcql_string" ,srcql_string )
689+ if type (prefix ) != str :
690+ raise srcMLTypeError (self .append_transform_srcql_element ,"prefix" ,prefix )
691+ if type (namespace_uri ) != str :
692+ raise srcMLTypeError (self .append_transform_srcql_element ,"namespace_uri" ,namespace_uri )
693+ if type (element ) != str :
694+ raise srcMLTypeError (self .append_transform_srcql_element ,"element" ,element )
695+
696+ status = libsrcml .srcml_append_transform_srcql_element (self .c_archive , srcql_string .encode (), prefix .encode (), namespace_uri .encode (), element .encode ())
697+ check_srcml_status (status )
698+
650699 # -------------------------------------------------------------------------------------------
651700 # Append an XSLT parameter to the last transformation
652701 # Parameter: param_name -> Name of a parameter
0 commit comments