so my results for my SQL Query is

Qt Code:
  1. 1000398| Main
  2. 1000398|1100413| Network
  3. 1000398|1100414| Plans
  4. 1000398|1100415| Support
  5. 1000402| Dine.To
  6. 1000403| TourismTo
  7. 1100399| Shopping
  8. 1100399|1100400| Store 1
  9. 1100399|1100401| Store 2
  10. 1100399|1100402| Store 3
  11. 1100399|1100403| Store 4
  12. 1100404| News
  13. 1100404|1100405| Canada
  14. 1100404|1100406| Politics
  15. 1100404|1100407| Soccer
  16. 1100408| Weather
  17. 1100409| Hotels
  18. 1100409|1100410| Holiday Inn
  19. 1100409|1100411| Hilton
To copy to clipboard, switch view to plain text mode 

i am writing this data using QXmlStreamWriter

Like so

Qt Code:
  1. QXmlStreamWriter output(&file);
  2. output.setCodec("UTF-8");
  3. output.setAutoFormatting(true);
  4. output.writeStartDocument();
  5. output.writeStartElement("Menu");
  6.  
  7. while (sqlSelFrmView.next())
  8. {
  9. output.writeStartElement("Model");
  10. output.writeTextElement("Name", sqlSelFrmView.value(1).toString());
  11. output.writeEndElement();
  12. }
  13.  
  14. output.writeEndDocument();
To copy to clipboard, switch view to plain text mode 

Sure this works but it write it in XML format as

Qt Code:
  1. <Menu>
  2. <Model>
  3. <Name>Main</Name>
  4. </Model>
  5. <Model>
  6. <Name> Network</Name>
  7. </Model>
  8. </Menu>
To copy to clipboard, switch view to plain text mode 

now i need to do something a little different

based off of my sql root items are level = 1 and sub items are level = 2

how can i write the data as
Qt Code:
  1. <Menu>
  2. <Model>
  3. <Name>Main</Name> // Level = 1
  4. <SubMenu>
  5. <Name> Network</Name> // Level = 2
  6. </SubMenu>
  7. </Model>
  8. </Menu>
To copy to clipboard, switch view to plain text mode