@@ -86,8 +86,8 @@ fn make_xml_error<'gc>(activation: &mut Activation<'_, 'gc>, err: XmlError) -> E
86
86
) ,
87
87
XmlSyntaxError :: UnclosedTag => type_error (
88
88
activation,
89
- "Error #1095 : XML parser failure: Unterminated attribute ." ,
90
- 1095 ,
89
+ "Error #1090 : XML parser failure: element is malformed ." ,
90
+ 1090 ,
91
91
) ,
92
92
XmlSyntaxError :: InvalidBangMarkup => type_error (
93
93
activation,
@@ -858,6 +858,34 @@ impl<'gc> E4XNode<'gc> {
858
858
1088 ,
859
859
) ?) ) ;
860
860
}
861
+ Err ( XmlError :: Syntax ( XmlSyntaxError :: UnclosedTag ) )
862
+ if top_level. is_empty ( ) && open_tags. is_empty ( ) =>
863
+ {
864
+ // Check if this looks like an unterminated attribute by examining the XML content
865
+ // Look for pattern: < followed by tag name, then space and attribute with = and quote
866
+ let error_pos = parser. error_position ( ) as usize ;
867
+
868
+ if error_pos < data_utf8. len ( ) {
869
+ let rest = & data_utf8[ error_pos..] ;
870
+ // Check if we have an attribute pattern (contains '=' and a quote)
871
+ if let Some ( tag_end_idx) = rest. find ( '>' ) {
872
+ let tag_content = & rest[ ..tag_end_idx] ;
873
+ if tag_content. contains ( '=' ) && ( tag_content. contains ( '\'' ) || tag_content. contains ( '"' ) ) {
874
+ return Err ( Error :: avm_error ( type_error (
875
+ activation,
876
+ "Error #1095: XML parser failure: Unterminated attribute." ,
877
+ 1095 ,
878
+ ) ?) ) ;
879
+ }
880
+ }
881
+ }
882
+ // Otherwise, it's a malformed element
883
+ return Err ( Error :: avm_error ( type_error (
884
+ activation,
885
+ "Error #1090: XML parser failure: element is malformed." ,
886
+ 1090 ,
887
+ ) ?) ) ;
888
+ }
861
889
Err ( err) => return Err ( make_xml_error ( activation, err) ) ,
862
890
} ;
863
891
0 commit comments