Create an hierarchical xml form an “flat” xml a like book description

后端 未结 2 1900
眼角桃花
眼角桃花 2021-01-17 05:36

This is a following up question to question to \"Select all of an element between the current element and the next of the current element\". Even If I\'m not sure if creatin

2条回答
  •  孤街浪徒
    2021-01-17 06:05

    Here is a generic solution that will work for any heading depth:

    
      
      
      
    
      
        
          
        
      
    
      
        
          
        
      
    
      
        
          
        
      
    
    

    When run on your sample input, this produces:

    
      
        ...
        ...
        
          ...
          
            ...
            ...
          
        
        
          ...
          ...
        
      
      
        ...
        ...
        
          ...
          ...
          ...
          
            ...
          
        
        
          ...
          ...
        
      
    
    

提交回复
热议问题