@@ -138,7 +138,9 @@ static lexbor_libxml2_bridge_status lexbor_libxml2_bridge_convert(
138138 * If a prefix:name format is used, then the local name will be "prefix:name" and the prefix will be empty.
139139 * There is however still somewhat of a concept of namespaces. There are three: HTML (the default), SVG, and MATHML. */
140140 lxb_dom_element_t * element = lxb_dom_interface_element (node );
141- const lxb_char_t * name = lxb_dom_element_local_name (element , NULL );
141+ const lxb_char_t * name = lxb_dom_element_qualified_name (element , NULL );
142+ ZEND_ASSERT (!element -> node .prefix );
143+
142144 xmlNodePtr lxml_element = xmlNewDocNode (lxml_doc , NULL , name , NULL );
143145 if (UNEXPECTED (lxml_element == NULL )) {
144146 retval = LEXBOR_LIBXML2_BRIDGE_STATUS_OOM ;
@@ -203,7 +205,13 @@ static lexbor_libxml2_bridge_status lexbor_libxml2_bridge_convert(
203205 for (lxb_dom_attr_t * attr = element -> first_attr ; attr != NULL ; attr = attr -> next ) {
204206 /* Same namespace remark as for elements */
205207 size_t local_name_length , value_length ;
206- const lxb_char_t * local_name = lxb_dom_attr_local_name (attr , & local_name_length );
208+ const lxb_char_t * local_name = lxb_dom_attr_qualified_name (attr , & local_name_length );
209+ if (attr -> node .prefix ) {
210+ const char * pos = strchr ((const char * ) local_name , ':' );
211+ if (EXPECTED (pos )) {
212+ local_name = (const lxb_char_t * ) pos + 1 ;
213+ }
214+ }
207215 const lxb_char_t * value = lxb_dom_attr_value (attr , & value_length );
208216
209217 if (UNEXPECTED (local_name_length >= INT_MAX || value_length >= INT_MAX )) {
0 commit comments