@@ -683,6 +683,8 @@ fn process_event(event: &Event, mut state: &mut State) -> Step {
683
683
else if state. path . len ( ) >= table. path . len ( ) {
684
684
if state. path == table. path { state. table . lastid . borrow_mut ( ) . clear ( ) ; }
685
685
if state. path == state. rowpath { state. fullcount += 1 ; }
686
+ let mut subtable = None ;
687
+
686
688
for i in 0 ..table. columns . len ( ) {
687
689
if state. path == table. columns [ i] . path { // This start tag matches one of the defined columns
688
690
// Handle the 'seri' case where this column is a virtual auto-incrementing serial
@@ -698,10 +700,8 @@ fn process_event(event: &Event, mut state: &mut State) -> Step {
698
700
}
699
701
// Handle 'subtable' case (the 'cols' entry has 'cols' of its own)
700
702
if table. columns [ i] . subtable . is_some ( ) {
701
- state. tables . push ( table) ;
702
- state. parentcol = Some ( & table. columns [ i] ) ;
703
- state. table = table. columns [ i] . subtable . as_ref ( ) . unwrap ( ) ;
704
- return Step :: Repeat ; // Continue the repeat loop because a subtable column may also match the current path
703
+ if subtable. is_some ( ) { fatalerr ! ( "Error: multiple subtables starting from the same element is not supported" ) ; }
704
+ subtable = Some ( i) ;
705
705
}
706
706
// Handle the 'attr' case where the content is read from an attribute of this tag
707
707
if let Some ( request) = table. columns [ i] . attr {
@@ -741,6 +741,12 @@ fn process_event(event: &Event, mut state: &mut State) -> Step {
741
741
}
742
742
}
743
743
}
744
+ if let Some ( i) = subtable {
745
+ state. tables . push ( table) ;
746
+ state. parentcol = Some ( & table. columns [ i] ) ;
747
+ state. table = table. columns [ i] . subtable . as_ref ( ) . unwrap ( ) ;
748
+ return Step :: Repeat ; // Continue the repeat loop because a subtable column may also match the current path
749
+ }
744
750
}
745
751
} ,
746
752
Event :: Text ( ref e) => {
0 commit comments