Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I deal with infopath forms with client object model and now I want to add new nodes to the xml, I had goten something with the code below:

         XmlNamespaceManager nameSpaceManager = new XmlNamespaceManager(xd.NameTable);
      nameSpaceManager.AddNamespace("my", "http://schemas.microsoft.com/office/infopath/2003/myXSD/2014-06-28T11:33:30");

      using (XmlWriter writer = xd.CreateNavigator().SelectSingleNode("/my:myFields/my:imagesGroup", nameSpaceManager).AppendChild())
      {

      writer.WriteStartElement("imageItem","my");
      writer.WriteElementString("field12", "my", "http://S_IMAGES/0.jpg");
      writer.WriteElementString("imageUploaded", "my", "http://S_IMAGES/140370.jpg");
      writer.WriteEndElement();

      }


      and the xml I got:



      <my:imagesGroup>
        <my:imageItem>
          <my:field12>http://xxx/1403545158770.jpg</my:field12>
          <my:imageUploaded my:field14="">http://s/1403545158770.jpg</my:imageUploaded>
        </my:imageItem>
        <imageItem xmlns="my">
          <field12>http://S/1770.jpg</field12>
          <imageUploaded>http://SMAGES/140.jpg</imageUploaded>
        </imageItem>
      </my:imagesGroup>

you can see that the first imageItem is ok (is from the original xml) and got my: before every field but the second one that I have generated has no the "my:", if i try to use it in the code it says me that the character is not posssible to use

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.