Getting the dialogue lines from the XML file, every time you need them can be quiet slow. But you can parse the XML file at the beginning and store the dialogue lines in an array for example. I would also change the XML structure a little bit... but you structure will do it as well. :)
<scene nr="1"><actor name="Bob"><line id="1">"Oh, hi thare!"</line><line id="2">"This is my second line."</line></actor></scene><scene nr=2><actor name="Bill"><line id="1">"I'm another actor!"</line></actor></scene>
And here an idea for the script (sorry, it's in C#):
public TextAsset dialogueXMLFile;
private void parseXML()
{
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(dialogueXMLFile.text);
XmlNodeList NodeList = xmlDoc.GetElementsByTagName("scene");
foreach (XmlNode sceneNode in NodeList)
{
//Get Scene Number
int sceneNr = sceneNode.Attributes["nr"].Value;
//get actors
foreach (XmlNode actorNode in sceneNode.ChildNodes)
{
//Get Actor name
string actorName = actorNode.Attributes["name"].Value;
//get lines and store the data in an array or what ever...
}
}