0

I am developing my knowledge base files these days and also I am trying to make an interface to update the templates in the knowledge base.
Say I have the following AIML file.

<?xml version=“1.0” encoding=“ISO-8859-1”?>
<aiml version=“1.0”>
  <category>
   <pattern> WHERE</pattern>
  <template>Where the heart is.</template>
  </category>
  <category>


  <category>
    <pattern>Hi</pattern>
  <template>Hello there</template>
  </category>
  <category>
</aiml>

I want to access the first pattern template. I am using c# for the development and the following coded gives only the InnterText of the specified Tag.

XmlNodeList nodelist = aiml.GetElementsByTagName(“pattern”);
TextBox1.Text = nodelist[0].InnerText;
or 
TextBox1.Text = nodelist[0].FirstChild.ChildNodes[0].InnerText;

But what I want is; if I give the pattern node list no as 0 or 1 then I need to read the InnerText of the related template.
Is there a way that I can get the access like that??
Any suggestions????
Thank you.

Edited by __avd: Added [code] tags.

2
Contributors
1
Reply
3
Views
7 Years
Discussion Span
Last Post by William Walseth
0

Use System.Xml.SelectNodes( strXPath ) or System.Xml.SelectSingleNode( strXPath ). Construct the strXPath something like this "/aiml/category/pattern"
Good luck.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.