Hi, all.
I've got an xml file of several recordings that looks like this:
<audiolibrary>
<prompt name="accountinfo">
<prompt-segment>
<audio src="audio/default/accountinfo.wav"
text="Account Information"/>
</prompt-segment>
</prompt>
...
<prompt name="accountclosed">
<prompt-segment>
<audio src="audio/default/accountclosed.wav"
text="Sorry, your account is closed."/>
</prompt-segment>
</prompt>
</audiolibrary>
Following an XPath tutorial, I know I can retrieve, for example, the attribute of the first prompt with the following expressions:
xPathObject.compile("/audioibrary/prompt[@name='accountinfo']/prompt-segment/audiofile/@src");
xPathObject.compile("/audioibrary/prompt[1]/prompt-segment/audiofile/@src");
Now, if I want to retrieve all of the prompts, am I understanding correctly that I should iterate through .compile() statements until I come up with a blank value?
Something like this skeletal example, here?:
int index = 1;
do
{
xPathObject.compile("/audioibrary/prompt["+ index +"]/prompt-segment/audiofile/@src");
(Prompt content retrieval code here)
index++;
}
while(!src.equals(""))
Or, is there a better way to retrieve the collection?
Thanks!
IVR Avenger