@@ -176,7 +176,8 @@ impl Default for ColumnConstraints {
176176/// `RawMigrationUnit` with SQL generated from its child change elements.
177177fn parse_changelog_xml ( xml : & str , source_path : & Path ) -> Result < Vec < RawMigrationUnit > , LoadError > {
178178 let mut reader = Reader :: from_str ( xml) ;
179- reader. trim_text ( true ) ;
179+ reader. config_mut ( ) . trim_text_start = true ;
180+ reader. config_mut ( ) . trim_text_end = true ;
180181
181182 let mut units: Vec < RawMigrationUnit > = Vec :: new ( ) ;
182183 let mut state = ParseState :: Root ;
@@ -200,7 +201,7 @@ fn parse_changelog_xml(xml: &str, source_path: &Path) -> Result<Vec<RawMigration
200201 let tag_name = local_name_str ( e. name ( ) . as_ref ( ) ) ;
201202 let attrs = collect_attributes ( e) ?;
202203 let is_empty = matches ! ( event, Event :: Empty ( _) ) ;
203- let current_line = byte_offset_to_line ( xml, reader. buffer_position ( ) ) ;
204+ let current_line = byte_offset_to_line ( xml, reader. buffer_position ( ) as usize ) ;
204205
205206 state = handle_start_tag (
206207 state,
@@ -221,10 +222,7 @@ fn parse_changelog_xml(xml: &str, source_path: &Path) -> Result<Vec<RawMigration
221222 state = handle_end_tag ( state, & tag_name, source_path, & mut units) ?;
222223 }
223224 Event :: Text ( ref e) => {
224- let text = e. unescape ( ) . map_err ( |err| LoadError :: Parse {
225- path : source_path. to_path_buf ( ) ,
226- message : format ! ( "XML text unescape error: {}" , err) ,
227- } ) ?;
225+ let text = String :: from_utf8_lossy ( e. as_ref ( ) ) ;
228226 state = handle_text ( state, & text) ;
229227 }
230228 Event :: CData ( ref e) => {
@@ -787,7 +785,8 @@ fn byte_offset_to_line(xml: &str, offset: usize) -> usize {
787785/// Extract `<include file="..."/>` paths from the XML, resolved relative to the parent file.
788786fn extract_include_paths ( xml : & str , source_path : & Path ) -> Result < Vec < PathBuf > , LoadError > {
789787 let mut reader = Reader :: from_str ( xml) ;
790- reader. trim_text ( true ) ;
788+ reader. config_mut ( ) . trim_text_start = true ;
789+ reader. config_mut ( ) . trim_text_end = true ;
791790 let mut buf = Vec :: new ( ) ;
792791 let mut paths = Vec :: new ( ) ;
793792
0 commit comments