Sorry for the long post.
I am not trying to make this anything much complicated. This is a rough example of how I plan the XML dialogue file to look like:
<root>
<character>
<name> Max Delmonte </name>
<alliance> Human Federation </alliance>
</character>
<dialogue>
<heading id="0">
<!--Normal meeting-->
<part id="1">
<l> Hey Capt'n! How's it going? </l>
<c id="1" goTo="End"> I have to go </c>
</part>
</heading>
<heading id="1">
<!--First time meeting with Delmonte-->
<part id="1">
<l> Captain Hart! I've heard so much about you. How are ya? </l>
<c id="1" goTo="p2"> What is a human doing so far from Federation space, and how do you know my name? </c>
<c id="2" goTo="Battle"> You are a dead dead dead man! </c>
<c id="3" goTo="p3"> test1 </c>
<c id="4" goTo="p4"> test2 </c>
<c id="5" goTo="p5"> test3 </c>
</part>
<!--Who are you? -->
<part id="2">
<l> Oh, my apologies captain. I am the one and only Max Delmonte, merchant and ladies man extraordinaire. </l>
<l> I am a merchant of all things useful, be it food or weapons. There is surely something you will find interesting. </l>
<c id="rem(p1)" />
<c id="1" goTo="DelmonteShop"> Let me see what you have. </c>
</part>
<!--What are you doing here, how do you know my name?-->
<part id="3">
</part>
</heading>
</dialogue>
</root>
l stands for line
c stands for choice
Each c has a goto which determines what happens once the choice is selected.
Dialogue is separated into headings and then parts. A heading constituting a major part or persistent dialogue such as a seller might have (in the example <heading id = "0"> is the default conversation you would have with an npc, in this case a merchant).
Special commands such <c id="rem(p1)" /> will take all the remaining options from part 1 (p1) from the parent heading. There of course can be more special commands to make this robust.
The player class will remember which options have been selected by their unique overall id obtained by concatenating the heading id, the part id, and the choice id.
Right now my rough version of the parser handles timing of the dialogue by the count of characters of a certain line, but it shouldn't be too difficult to add a value for voice-over timing.
Writing all the dialogue of a branching game would of course get really hard if done by hand (considering it would be really hard done with a proper tool as well) which is why I plan on writing an editor.
The biggest weakness of my plan is that it doesn't allow for multi-NPC dialogue but I am thinking that would make things more complicated than I would like them to be.
In reality very few games do branching dialogue. In fact the only ones that I can think of are Arcanum (<3) and Fallout.
I believe the way IFs handle dialogue is not appropriate for a standard visual rpg type game, but correct me if I'm wrong.
Suggestions on how to improve the format or potential pitfalls would be welcomed.