468,512 Members | 1,481 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,512 developers. It's quick & easy.

My xml create new verion on my Desktop

5
Good Day

I am creating my first internet explore add-in , my add-in combine between SR and TTS, the user will say any word and if the word in xml file the add-in will generate URL if not the add-in will display error MSG , also the user can add new word to xml file . the problem that I am facing now when setup my add-in and run it on internet explore error msg display and when click continue the new version of xml file will create on my desktop ,I saved xml file in debug file .



Expand|Select|Wrap|Line Numbers
  1. try
  2.             {
  3.                 XmlTextWriter writer = new XmlTextWriter("Grammar.xml", Encoding.UTF8);
  4.                 writer.Formatting = Formatting.Indented;
  5.  
  6.                 writer.WriteStartDocument();
  7.                 writer.WriteStartElement("grammar");
  8.                 writer.WriteAttributeString("xmlns", "http://www.w3.org/2001/06/grammar");
  9.                 writer.WriteAttributeString("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
  10.                 writer.WriteAttributeString("xml:lang", "en-US");
  11.                 writer.WriteAttributeString("version", "1.0");
  12.                 writer.WriteAttributeString("root", "command1");
  13.                 writer.WriteStartElement("rule ");
  14.                 writer.WriteAttributeString("id", "command1");
  15.                 writer.WriteAttributeString("scope", "public");
  16.                 writer.WriteStartElement("one-of");
  17.  
  18.  
  19.                 foreach (string item in listBox1.Items)
  20.                 {
  21.                     writer.WriteStartElement("item");
  22.                     writer.WriteString(item);
  23.                     writer.WriteEndElement(); //WORD
  24.                 }
  25.  
  26.                 writer.WriteEndElement(); //COMMAND
  27.                 writer.WriteEndElement();
  28.                 writer.WriteEndElement();
  29.                 writer.WriteEndDocument();// End Document
  30.  
  31.                 writer.Close();
  32.                 MessageBox.Show("THE NEW WORDS ADD TO THE XML FILE !!", "Message");
  33.             }

Thank u
Dec 5 '12 #1
0 1897

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

5 posts views Thread by Eskimo Joe | last post: by
2 posts views Thread by Jimi | last post: by
2 posts views Thread by laredotornado | last post: by
3 posts views Thread by thi | last post: by
reply views Thread by NPC403 | last post: by
1 post views Thread by fmendoza | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.